Exemple #1
0
        /// <summary>
        /// Gets the content stream of the catalog entry by specified entry identifier.
        /// </summary>
        /// <param name="id">The catalog entry identifier.</param>
        /// <param name="offset">The offset index.</param>
        /// <param name="length">The number of bytes from byte array to return.</param>
        /// <returns>
        /// The operation result containing the instance of <see cref="CatalogEntryStream" />.
        /// </returns>
        public async Task <ServiceResult <CatalogEntryStream> > GetEntryStreamAsync(Guid id, int offset, int length = 1024)
        {
            CatalogEntry entry = new CatalogEntry()
            {
                ID = id
            };

            IServiceFactory <ICatalogEntryValidator> validator = this.validationServiceFactory.GetFactory <ICatalogEntryValidator>();
            ValidationResult result = await validator.Get <IPresenceValidator>().ValidateAsync(entry);

            if (!result.IsValid)
            {
                return(new ServiceResult <CatalogEntryStream>(new CatalogEntryStream(entry, 0))
                {
                    Errors = result.Errors
                });
            }

            CatalogEntryStream stream = null;

            Func <IDataProvider, Task> getCatalogEntryStreamFunction = async provider => entry = await provider.GetCatalogEntry(entry);

            this.processor.CreateDataHandler <IDataCommandHandler>().CreateAsyncCommand <IAggregationDataProvider>(async provider => entry = await provider.GetCatalogEntry(entry), null);
            this.processor.CreateDataHandler <IDataCommandHandler>()
            .CreateAsyncCommand <IDataStoreProvider>(async provider => entry   = await provider.GetCatalogEntry(entry), null)
            .CreateAsyncCommand <IFileSystemProvider>(async provider => stream = await provider.GetCatalogEntryStream(entry, offset, length), null);

            await this.processor.ProcessAsync();

            return(new ServiceResult <CatalogEntryStream>(stream));
        }
Exemple #2
0
        /// <summary>
        /// Gets the catalog entry by specified identifier.
        /// </summary>
        /// <param name="id">The catalog entry identifier.</param>
        /// <returns>
        /// The operation result containing the instance of <see cref="T:HomeCloud.DataStorage.Business.Entities.CatalogEntry" />.
        /// </returns>
        public async Task <ServiceResult <CatalogEntry> > GetEntryAsync(Guid id)
        {
            CatalogEntry entry = new CatalogEntry()
            {
                ID = id
            };

            IServiceFactory <ICatalogEntryValidator> validator = this.validationServiceFactory.GetFactory <ICatalogEntryValidator>();
            ValidationResult result = await validator.Get <IPresenceValidator>().ValidateAsync(entry);

            if (!result.IsValid)
            {
                return(new ServiceResult <CatalogEntry>(entry)
                {
                    Errors = result.Errors
                });
            }

            Func <IDataProvider, Task> getCatalogEntryFunction = async provider => entry = await provider.GetCatalogEntry(entry);

            this.processor.CreateDataHandler <IDataCommandHandler>()
            .CreateAsyncCommand <IDataStoreProvider>(getCatalogEntryFunction, null)
            .CreateAsyncCommand <IAggregationDataProvider>(getCatalogEntryFunction, null);

            await this.processor.ProcessAsync();

            return(new ServiceResult <CatalogEntry>(entry));
        }
        public ActionResult SelectedProduct(int id)
        {
            CatalogEntry         entry = _catalogService.TryGet(id);
            SelectedProductModel model = entry.ToSelectedProductModel();

            return(View(model));
        }
Exemple #4
0
        /// <summary>
        /// Creates the specified catalog entry.
        /// </summary>
        /// <param name="stream">The stream of <see cref="CatalogEntryStream" /> type to create the entry from.</param>
        /// <returns>The newly created instance of <see cref="CatalogEntry" /> type.</returns>
        public async Task <CatalogEntry> CreateCatalogEntry(CatalogEntryStream stream)
        {
            CatalogEntry entry = stream.Entry;

            FileDocument fileDocument = await this.mapper.MapNewAsync <CatalogEntry, FileDocument>(entry);

            CatalogDocument catalogDocument = null;

            using (IDocumentContextScope scope = this.dataContextScopeFactory.CreateDocumentContextScope(this.connectionStrings.DataAggregationDB))
            {
                IFileDocumentRepository fileRepository = scope.GetRepository <IFileDocumentRepository>();
                fileDocument = await fileRepository.SaveAsync(fileDocument);

                if ((entry.Catalog?.ID).HasValue)
                {
                    ICatalogDocumentRepository catalogRepository = scope.GetRepository <ICatalogDocumentRepository>();
                    catalogDocument = await catalogRepository.GetAsync(entry.Catalog.ID);
                }
            }

            entry = await this.mapper.MapAsync(fileDocument, entry);

            entry.Catalog = await this.mapper.MapAsync(catalogDocument, entry.Catalog);

            return(entry);
        }
 internal override bool Execute()
 {
     if (FileSystem.directoriesAndFiles[FileSystem.CurrentDirectory.FirstBlockNumber] != null)
     {
         if (!FileSystem.CurrentDirectory.Attributes.Subdirectory)
         {
             return(false);
         }
         StartDirectory = (Directory)FileSystem.directoriesAndFiles[FileSystem.CurrentDirectory.FirstBlockNumber];
         int[]        clusters              = FileSystem.FAT.GetFileBlocks(StartDirectory.FirstClusterNumber);
         string[]     directories           = fullName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
         CatalogEntry currentDirectoryEntry = FileSystem.CurrentDirectory;
         for (int i = 0; i < directories.Length; i++)
         {
             currentDirectoryEntry = StartDirectory.FindSubDirectory(directories[i], clusters);
             if (currentDirectoryEntry == null || FileSystem.directoriesAndFiles[currentDirectoryEntry.FirstBlockNumber] == null)
             {
                 return(false);
             }
             StartDirectory = (Directory)FileSystem.directoriesAndFiles[currentDirectoryEntry.FirstBlockNumber];
             clusters       = FileSystem.FAT.GetFileBlocks(StartDirectory.FirstClusterNumber);
         }
         FileSystem.CurrentDirectory = currentDirectoryEntry;
         FileSystem.CurrentDirectory.LastAccessDate.SetCurrentDate();
         return(true);
     }
     else
     {
         return(false);
     }
 }
        /// <summary>
        /// Deserialize JSON into a FHIR CatalogEntry
        /// </summary>
        public static void DeserializeJson(this CatalogEntry current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"CatalogEntry >>> CatalogEntry.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"CatalogEntry: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
Exemple #7
0
        private static PackageInfo GetPackageInfo(CatalogEntry entry)
        {
            try
            {
                // This is ugly. There must be something better. Not using Task.Run as we don't have any
                // synchronization context anyway.
                var nuspec = entry.GetNuspecAsync().Result;
                int loaded = Interlocked.Increment(ref s_loadedPackageCount);
                if (loaded % 100 == 0)
                {
                    Console.WriteLine($"{DateTime.UtcNow:HH:mm:ss} Loaded dependencies for {loaded} packages.");
                }

                return(new PackageInfo
                {
                    Id = entry.Id,
                    Version = entry.Version.ToString(),
                    Dependencies = nuspec.GetDependencyGroups()
                                   .SelectMany(dg => dg.Packages)
                                   .Select(d => d.Id)
                                   .Distinct()
                                   .ToList()
                });
            }
            catch
            {
                Console.WriteLine($"Failed to fetch dependencies for {entry.Id}");
                Interlocked.Increment(ref s_failureCount);
                return(null);
            }
        }
Exemple #8
0
        internal static async Task <NupkgResult> RunWithRetryAsync(
            CatalogEntry entry,
            bool ignoreErrors,
            Func <CatalogEntry, Task <FileInfo> > action,
            ILogger log,
            CancellationToken token)
        {
            var success = false;
            var result  = new NupkgResult()
            {
                Entry = entry
            };

            // Retry up to 10 times.
            for (var i = 0; !success && i < 10 && !token.IsCancellationRequested; i++)
            {
                try
                {
                    // Download
                    result.Nupkg = await action(entry);

                    success = true;
                }
                catch (HttpRequestException ex) when(ex.Message.Contains("404"))
                {
                    log.LogWarning($"Unable to download {entry.Id} {entry.Version.ToFullString()}"
                                   + Environment.NewLine
                                   + MirrorUtility.GetExceptions(ex, "\t- "));

                    // Ignore missing packages, this is an issue with the feed.
                    success = true;
                }
                catch (Exception ex) when(i < 9)
                {
                    // Log a warning and retry
                    log.LogWarning($"Unable to download {entry.Id} {entry.Version.ToFullString()}. Retrying..."
                                   + Environment.NewLine
                                   + MirrorUtility.GetExceptions(ex, "\t- ").TrimEnd());
                }
                catch (Exception ex)
                {
                    // Log an error and fail
                    log.LogError($"Unable to download {entry.Id} {entry.Version.ToFullString()}"
                                 + Environment.NewLine
                                 + MirrorUtility.GetExceptions(ex, "\t- ").TrimEnd());

                    if (!ignoreErrors)
                    {
                        throw;
                    }
                }

                if (!success && i < 9)
                {
                    await Task.Delay(TimeSpan.FromSeconds((i + 1) * 5));
                }
            }

            return(result);
        }
Exemple #9
0
        public void NuGetGroupsToDependencyGroups_ShouldIncludeFrameworkDependencies()
        {
            var result = CatalogEntry.ToDependencyGroups(nugetFrameworkDeps, "http://catalog/package.json", GetRegistrationUrl);

            Assert.All(result, r => Assert.Null(r.Dependencies));
            Assert.Equal(new string[] { "netstandard2.0", "net35" }, result.Select(s => s.TargetFramework));
        }
        protected override string GetPackageFilePath(DirectoryInfo storagePath, CatalogEntry entry)
        {
            var checkOutputDir = Path.Combine(storagePath.FullName, entry.Id.ToLowerInvariant());
            var checkNupkgPath = Path.Combine(checkOutputDir, $"{entry.FileBaseName}.nupkg");

            return(checkNupkgPath);
        }
        private async Task VerifyExpectedLeafUrlAsync(CatalogEntry entry, CatalogLeafEntity leafEntity)
        {
            var entryUrl       = entry.Uri.OriginalString;
            var catalogBaseUrl = await GetCatalogBaseUrlAsync();

            if (!entryUrl.StartsWith(catalogBaseUrl))
            {
                throw new InvalidOperationException("The catalog leaf URL should start with the catalog base URL.");
            }

            var actualPath   = entryUrl.Substring(catalogBaseUrl.Length);
            var expectedPath = string.Join("/", new[]
            {
                "data",
                entry.CommitTimeStamp.ToString("yyyy.MM.dd.HH.mm.ss"),
                $"{Uri.EscapeDataString(entry.Id.ToLowerInvariant())}.{entry.Version.ToNormalizedString().ToLowerInvariant()}.json",
            });

            // This should always be true, but we have an oddball:
            // https://api.nuget.org/v3/catalog0/page848.json
            // https://api.nuget.org/v3/catalog0/data/2015.04.03.23.35.56/xunit.core.2.0.0.json
            // Timestamp is 2015-04-03T23:14:16.0340591Z
            if (actualPath != expectedPath)
            {
                leafEntity.RelativePath = actualPath;
            }
            else
            {
                leafEntity.RelativePath = null;
            }
        }
Exemple #12
0
        public void SearchForLessEntries()
        {
            Catalog catalog = new Catalog();

            string[]     entryParams = { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
            CatalogEntry entry       = new CatalogEntry(Content.Book, entryParams);

            catalog.Add(entry);

            AddSomeEntries(catalog, ref entryParams, ref entry);

            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);
            catalog.Add(entry);

            bool searchIsAccurate = false;
            IEnumerable <IContent> searchResult = catalog.GetListContent("One", 5);
            IEnumerable <IContent> all          = catalog.GetListContent("One", 30);

            if (searchResult.Count() == 5 && all.Count() == 11)
            {
                searchIsAccurate = true;
            }


            Assert.AreEqual(true, searchIsAccurate);
        }
Exemple #13
0
    protected void Display_ViewAll()
    {
        CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef);
        System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
        Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

        entryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
        entryCriteria.PagingInfo.CurrentPage = _currentPageNumber;

        entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_iID);
        entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage);
        entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
        entryCriteria.AddFilter(EntryProperty.IsPublished, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);

        entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
        entryCriteria.OrderByField = Util_GetSortColumn();

        switch (m_sPageAction)
        {
            case "browsecrosssell":
            case "browseupsell":
            case "couponselect":

                // If m_sPageAction = "couponselect" Then entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, CatalogEntryType.SubscriptionProduct)
                entryList = CatalogManager.GetList(entryCriteria);
                break;

            case "browse":

                long[] IdList = new long[3];

                IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                // IdList(1) = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct
                entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                if (excludeId > 0)
                {
                    entryCriteria.AddFilter(EntryProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, excludeId);
                }
                entryList = CatalogManager.GetList(entryCriteria);
                break;

            default:

                pnl_catalogs.Visible = true;
                pnl_viewall.Visible = false;
                System.Collections.Generic.List<CatalogData> catalogList = new System.Collections.Generic.List<CatalogData>();
                catalogList = CatalogManager.GetCatalogList(1, 1);
                Util_ShowCatalogs(catalogList);
                break;

        }

        TotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

        if (TotalPagesNumber > 1) {
            SetPagingUI();
        }

        Populate_ViewCatalogGrid(entryList);
    }
        public CollectionInfo(string CollectionID)
        {
            Collection c = Store.GetStore().GetCollectionByID(CollectionID);

            CatalogEntry entry = Catalog.GetEntryByCollectionID(CollectionID);

//			this.ID = entry.ID;
            this.ID              = c.ID;
            this.CollectionID    = c.ID;
            this.Name            = c.Name;
            this.Description     = GetStringProperty(c, PropertyTags.Description);
            this.DomainID        = c.Domain;
            this.HostID          = c.HostID;
            this.DirNodeID       = c.GetRootDirectory().ID;
            this.DirNodeName     = c.GetRootDirectory().Name;
            this.Size            = c.StorageSize;
            this.Created         = GetDateTimeProperty(c, PropertyTags.NodeCreationTime);
            this.LastModified    = GetDateTimeProperty(c, PropertyTags.JournalModified);
            this.MemberCount     = c.GetMemberList().Count;
            this.Disabled        = c.Disabled;
            this.MigratediFolder = c.MigratediFolder;

            this.OwnerID = c.Owner.UserID;
            Domain domain       = Store.GetStore().GetDomain(this.DomainID);
            Member domainMember = domain.GetMemberByID(this.OwnerID);

            this.OwnerUserName = domainMember.Name;
            string fullName = domainMember.FN;

            this.OwnerFullName = (fullName != null) ? fullName : this.OwnerUserName;

            this.encryptionAlgorithm = c.EncryptionAlgorithm;
        }
        /// <summary>
        /// Creates the specified catalog entry.
        /// </summary>
        /// <param name="stream">The stream of <see cref="CatalogEntryStream" /> type to create the entry from.</param>
        /// <returns>The newly created instance of <see cref="CatalogEntry" /> type.</returns>
        public async Task <CatalogEntry> CreateCatalogEntry(CatalogEntryStream stream)
        {
            CatalogEntry entry = stream.Entry;

            FileContract fileContract = await this.mapper.MapNewAsync <CatalogEntry, FileContract>(entry);

            CatalogContract catalogContract = null;

            using (IDbContextScope scope = this.dataContextScopeFactory.CreateDbContextScope(this.connectionStrings.DataStorageDB, true))
            {
                IFileRepository fileRepository = scope.GetRepository <IFileRepository>();
                fileContract = await fileRepository.SaveAsync(fileContract);

                ICatalogRepository catalogRepository = scope.GetRepository <ICatalogRepository>();
                catalogContract = await catalogRepository.GetAsync(fileContract.DirectoryID);

                scope.Commit();
            }

            entry = await this.mapper.MapAsync(fileContract, entry);

            entry.Catalog = await this.mapper.MapAsync(catalogContract, entry.Catalog);

            return(entry);
        }
Exemple #16
0
        /// <summary>
        /// Gets the catalog entry by the initial instance set.
        /// </summary>
        /// <param name="entry">The initial catalog entry set.</param>
        /// <param name="offset">The offset index.</param>
        /// <param name="length">The number of bytes from byte array to return.</param>
        /// <returns>
        /// The instance of <see cref="CatalogEntry" /> type.
        /// </returns>
        public async Task <CatalogEntryStream> GetCatalogEntryStream(CatalogEntry entry, int offset = 0, int length = 0)
        {
            entry = await this.GetCatalogEntry(entry);

            if (File.Exists(entry.Path))
            {
                lock (FileAccessSyncObject)
                {
                    if (File.Exists(entry.Path))
                    {
                        using (FileStream stream = new FileStream(entry.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                        {
                            long count = length == 0 ? stream.Length : length;

                            byte[] buffer = new byte[count];
                            stream.Read(buffer, offset, (int)count);

                            CatalogEntryStream result = new CatalogEntryStream(entry, count);

                            result.Write(buffer, 0, (int)count);
                        }
                    }
                }
            }

            return(new CatalogEntryStream(entry, 0));
        }
Exemple #17
0
        private void MergeWithEntry(
            string context,
            string msgid,
            string msgidPlural,
            string inputFile,
            int line)
        {
            // Processing
            CatalogEntry entry      = Catalog.FindItem(msgid, context);
            bool         entryFound = entry != null;

            if (!entryFound)
            {
                entry = new CatalogEntry(Catalog, msgid, msgidPlural);
            }

            // Add source reference if it not exists yet
            // Each reference is in the form "path_name:line_number"
            string sourceRef = String.Format("{0}:{1}",
                                             Utils.FileUtils.GetRelativeUri(Path.GetFullPath(inputFile), Path.GetFullPath(Options.OutFile)),
                                             line);

            entry.AddReference(sourceRef); // Wont be added if exists

            if (FormatValidator.IsFormatString(msgid) || FormatValidator.IsFormatString(msgidPlural))
            {
                if (!entry.IsInFormat("csharp"))
                {
                    entry.Flags += ", csharp-format";
                }
                Trace.WriteLineIf(
                    !FormatValidator.IsValidFormatString(msgid),
                    String.Format("Warning: string format may be invalid: '{0}'\nSource: {1}", msgid, sourceRef));
                Trace.WriteLineIf(
                    !FormatValidator.IsValidFormatString(msgidPlural),
                    String.Format("Warning: plural string format may be invalid: '{0}'\nSource: {1}", msgidPlural, sourceRef));
            }

            if (!String.IsNullOrEmpty(msgidPlural))
            {
                if (!entryFound)
                {
                    AddPluralsTranslations(entry);
                }
                else
                {
                    UpdatePluralEntry(entry, msgidPlural);
                }
            }
            if (!String.IsNullOrEmpty(context))
            {
                entry.Context = context;
                entry.AddAutoComment(String.Format("Context: {0}", context), true);
            }

            if (!entryFound)
            {
                Catalog.AddItem(entry);
            }
        }
        protected override string GetPackageFilePath(DirectoryInfo storagePath, CatalogEntry entry)
        {
            var currentResolver = new VersionFolderPathResolver(storagePath.FullName);
            var checkNupkgPath  = currentResolver.GetPackageFilePath(entry.Id, entry.Version);

            return(checkNupkgPath);
        }
    public void UpdateCatalog(CatalogEntry[] catalogEntries)
    {
        // Perform any validation/pre-processing on catalogEntries...

          // Updating the catalog requires exclusive access to it.
          m_gate.BeginWrite(UpdateCatalog, catalogEntries,
         delegate(IAsyncResult result) { m_gate.EndWrite(result); }, null);
    }
Exemple #20
0
        public void NuGetGroupsToDependencyGroups_ShouldGroupDependenciesWithoutFrameworkTogether()
        {
            var result = CatalogEntry.ToDependencyGroups(nugetAnyFrameworkPackageDeps, "http://catalog/package.json", GetRegistrationUrl);
            var deps   = result.First();

            Assert.Equal(new string[] { "dep1", "dep2" }, deps.Dependencies.Select(d => d.Id));
            Assert.All(result, r => Assert.Null(r.TargetFramework));
        }
 public CatalogEntry TryGet(int id)
 {
     using (var context = _createStoreContext())
     {
         CatalogEntry entry = context.CatalogEntries.Find(id);
         return(entry);
     }
 }
 public void Add(CatalogEntry entry)
 {
     using (var context = _createStoreContext())
     {
         context.CatalogEntries.Add(entry);
         context.SaveChanges();
     }
 }
Exemple #23
0
        /// <summary>
        /// Validates the specified instance of <see cref="CatalogEntry"/> type.
        /// </summary>
        /// <param name="instance">The instance to validate.</param>
        /// <returns>The instance of <see cref="ValidationResult"/> indicating whether the specified instance is valid and containing the detailed message about the validation result.</returns>
        public async Task <ValidationResult> ValidateAsync(CatalogEntry instance)
        {
            if (!string.IsNullOrWhiteSpace(instance.Name))
            {
                this.If(async id => await this.dataProviderFactory.Get <IDataStoreProvider>().CatalogEntryExists(instance)).AddError(new AlreadyExistsException("Catalog entry with specified name already exists."));
            }

            return(await this.ValidateAsync(instance.ID));
        }
        public CollectionInfo(string CollectionID, string UserID)
        {
            Collection c = Store.GetStore().GetCollectionByID(CollectionID);

            CatalogEntry entry = Catalog.GetEntryByCollectionID(CollectionID);

//			this.ID = entry.ID;
            this.ID           = c.ID;
            this.CollectionID = c.ID;
            this.Name         = c.Name;
            this.Description  = GetStringProperty(c, PropertyTags.Description);
            this.DomainID     = c.Domain;

//			this.HostID = c.HostID;
            this.HostID       = HostNode.GetLocalHost().UserID;
            this.DirNodeID    = c.GetRootDirectory().ID;
            this.DirNodeName  = c.GetRootDirectory().Name;
            this.Size         = c.StorageSize;
            this.Created      = GetDateTimeProperty(c, PropertyTags.NodeCreationTime);
            this.LastModified = GetDateTimeProperty(c, PropertyTags.JournalModified);
            this.MemberCount  = c.GetMemberList().Count;
            this.Disabled     = c.Disabled;

            this.OwnerID = c.Owner.UserID;
            Domain domain       = Store.GetStore().GetDomain(this.DomainID);
            Member domainMember = domain.GetMemberByID(this.OwnerID);

            this.OwnerUserName = domainMember.Name;
            string fullName = domainMember.FN;

            this.OwnerFullName = (fullName != null) ? fullName : this.OwnerUserName;

            this.encryptionAlgorithm = c.EncryptionAlgorithm;
            this.MigratediFolder     = c.MigratediFolder;


            Member member = c.GetMemberByID(UserID);

            if (member == null && Simias.Service.Manager.LdapServiceEnabled == true)
            {
                string[] IDs = domain.GetMemberFamilyList(UserID);
                foreach (string id in IDs)
                {
                    member = c.GetMemberByID(id);
                    if (member != null)
                    {
                        break;
                    }
                }
            }
            if (member != null)
            {
                this.MemberNodeID = member.ID;
                this.MemberUserID = member.UserID;
                this.UserRights   = member.Rights.ToString();
            }
        }
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="ce">catalog entry object</param>
 public CatalogInfo(CatalogEntry ce)
 {
     this.CollectionID      = ce.CollectionID;
     this.HostID            = ce.HostID;
     this.UserIDs           = ce.UserIDs;
     this.CollectionName    = ce.Name;
     this.CollectionSize    = ce.CollectionSize;
     this.CollectionOwnerID = ce.OwnerID;
 }
Exemple #26
0
 internal void Add(string[] msgids, string[] msgstrs)
 {
     //map with first msgid
     if (msgids.Length < 0)
     {
         return;
     }
     Entries[msgids[0]] = new CatalogEntry(msgids, msgstrs);
 }
Exemple #27
0
        /// <summary>
        /// Gets a value indicating whether the specified catalog entry already exists.
        /// </summary>
        /// <param name="entry">The catalog entry.</param>
        /// <returns><c>true</c> if the catalog entry exists. Otherwise <c>false.</c></returns>
        public async Task <bool> CatalogEntryExists(CatalogEntry entry)
        {
            using (IDocumentContextScope scope = this.dataContextScopeFactory.CreateDocumentContextScope(this.connectionStrings.DataAggregationDB))
            {
                IFileDocumentRepository repository = scope.GetRepository <IFileDocumentRepository>();

                return((await repository.GetAsync(entry.ID)) != null);
            }
        }
Exemple #28
0
        /// <summary>
        /// Validates the specified instance of <see cref="CatalogEntry"/> type.
        /// </summary>
        /// <param name="instance">The instance to validate.</param>
        /// <returns>The instance of <see cref="ValidationResult"/> indicating whether the specified instance is valid and containing the detailed message about the validation result.</returns>
        public async Task <ValidationResult> ValidateAsync(CatalogEntry instance)
        {
            this.If(async id => !await this.dataProviderFactory.Get <IDataStoreProvider>().CatalogEntryExists(new CatalogEntry()
            {
                ID = id
            })).AddError(new NotFoundException("Specified catalog entry does not exist."));

            return(await this.ValidateAsync(instance.ID));
        }
Exemple #29
0
        internal static string GetV3Path(
            CatalogEntry entry,
            string rootDir)
        {
            // id/version/id.version.nupkg
            var versionFolderResolver = new VersionFolderPathResolver(rootDir);

            return(versionFolderResolver.GetPackageFilePath(entry.Id, entry.Version));
        }
 public bool Update(CatalogEntry entry)
 {
     using (var context = _createStoreContext())
     {
         context.Entry(entry).State = EntityState.Modified;
         context.SaveChanges();
     }
     return(true);
 }
Exemple #31
0
        internal static string GetV2Path(
            CatalogEntry entry,
            string rootDir)
        {
            // id/id.version.nupkg
            var outputDir = Path.Combine(rootDir, entry.Id.ToLowerInvariant());

            return(Path.Combine(outputDir, $"{entry.FileBaseName}.nupkg"));
        }
 public void Delete(CatalogEntry entry)
 {
     using (var context = _createStoreContext())
     {
         context.CatalogEntries.Attach(entry);
         context.CatalogEntries.Remove(entry);
         context.SaveChanges();
     }
 }
Exemple #33
0
    private void Display_MoveEntries()
    {
        CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef);
            System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
            Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

            security_data = m_refContentApi.LoadPermissions(m_intId, "folder", 0);

            entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_intId);
            if (m_refContentApi.RequestInformationRef.ContentLanguage > 0)
            {
                entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage);
            }
            entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
            entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
            entryCriteria.OrderByField = EntryProperty.Title;

            entryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
            entryCriteria.PagingInfo.CurrentPage = m_intCurrentPage;

            entryList = CatalogManager.GetList(entryCriteria);

            m_intTotalPages = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

            // td_copy.Visible = False

            MoveContentByCategoryToolBar();

            FolderId = folder_data.Id.ToString();

            source_folder_is_xml.Value = "1";

            Page.ClientScript.RegisterHiddenField("xmlinherited", "false");

            lblDestinationFolder.Text = "<input id=\"move_folder_id\" size=\"50%\" name=\"move_folder_id\" value=\"\\\" readonly=\"true\"/>  <a href=\"#\" onclick=\"LoadSelectCatalogFolderChildPage();return true;\">" + m_refMsg.GetMessage("lbl ecomm coupon select folder") + "</a>";

            folder_id.Value = m_intId.ToString();
            PageSettings();

            Populate_MoveCatalogGrid(entryList);
    }
Exemple #34
0
    public bool ViewContentByCategory()
    {
        _CurrentUserId = _ContentApi.UserId;
        _AppImgPath = _ContentApi.AppImgPath;
        _AppPath = _ContentApi.AppPath;
        _SitePath = _ContentApi.SitePath;
        _EnableMultilingual = _ContentApi.EnableMultilingual;

        url_action.Text = _PageAction;
        url_id.Text = _Id.ToString();

        if (_FolderData == null)
        {
            _FolderData = _ContentApi.GetFolderById(_Id);
        }
        if (_FolderData == null)
        {
            Response.Redirect((string)("reterror.aspx?info=" + _MessageHelper.GetMessage("com: folder does not exist")), true);
            return false;
        }
        else
        {
            if (_FolderData.XmlConfiguration != null)
            {
                _HasXmlConfig = true;
            }
            _PermissionData = _ContentApi.LoadPermissions(_Id, "folder", 0);
            _FolderType = _FolderData.FolderType;
        }

        //Setting JS Variable for global use through workarea.aspx page.
        pasteFolderType.Text = Convert.ToString(_FolderData.FolderType);
        pasteFolderId.Text = Convert.ToString(_FolderData.Id);
        pasteParentId.Text = Convert.ToString(_FolderData.ParentId);

        if (!string.IsNullOrEmpty(Request.QueryString["IsArchivedEvent"]))
        {
            _IsArchivedEvent = Convert.ToBoolean(Request.QueryString["IsArchivedEvent"]);
            is_archived.Text = Convert.ToString(_IsArchivedEvent);
        }

        _AssetInfoData = _ContentApi.GetAssetSupertypes();
        if ((Ektron.Cms.Common.EkConstants.CMSContentType_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Content == Convert.ToInt32(_ContentTypeSelected)) || (Ektron.Cms.Common.EkConstants.CMSContentType_XmlConfig == Convert.ToInt32(_ContentTypeSelected)))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (Ektron.Cms.Common.EkConstants.CMSContentType_Forms == Convert.ToInt32(_ContentTypeSelected) || Ektron.Cms.Common.EkConstants.CMSContentType_Archive_Forms == Convert.ToInt32(_ContentTypeSelected))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }
        else if (_ManagedAsset_Min <= Convert.ToInt32(_ContentTypeSelected) && Convert.ToInt32(_ContentTypeSelected) <= _ManagedAsset_Max)
        {
            if (DoesAssetSupertypeExist(_AssetInfoData, int.Parse(_ContentTypeSelected)))
            {
                _ContentType = int.Parse(_ContentTypeSelected);
            }
        }
        else if (Convert.ToInt32(_ContentTypeSelected) == _CMSContentType_AllTypes)
        {
            _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_NonLibraryForms;
        }
        else if (_IsArchivedEvent == true && (Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_ManagedFiles || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_OfficeDoc || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_MultiMedia || Convert.ToInt32(_ContentTypeSelected) == EkConstants.CMSContentType_Archive_Images))
        {
            _ContentType = int.Parse(_ContentTypeSelected);
        }

        _ContentTypeSelected = _ContentType.ToString();

        _PageData = new Microsoft.VisualBasic.Collection();
        _PageData.Add(_Id, "FolderID", null, null);
        if (_FolderData.FolderType == 1) //blog
        {
            _PageData.Add("BlogPost", "OrderBy", null, null);
        }
        else
        {
            _PageData.Add(_OrderBy, "OrderBy", null, null);
        }
        if (Request.QueryString["orderbydirection"] == "desc")
            direction = "desc";
        else
            direction = "asc";
        _OrderByDirection = direction;
        _PageData.Add(_OrderByDirection, "OrderByDirection", null, null);
        _PageData.Add(_ContentLanguage, "m_intContentLanguage", null, null);
        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)_FolderData.FolderType)
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                _ContentType = Ektron.Cms.Common.EkConstants.CMSContentType_Content;
                _PageData.Add(_ContentType, "ContentType", null, null);
                break;
            default:
                if (_ContentType > 0)
                {
                    _PageData.Add(_ContentType, "ContentType", null, null);
                }
                break;
        }

        if (_ContentType == 1 && _ContentSubTypeSelected != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.AllTypes)
        {
            _PageData.Add(_ContentSubTypeSelected, "ContentSubType", null, null);
        }

        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            calendardisplay.Visible = true;
            pnlThreadedDiscussions.Visible = false;
            if ((Request.QueryString["showAddEventForm"] != null) && Request.QueryString["showAddEventForm"] == "true")
            {
                if (ViewState["AddEventFormDisplay"] == null || System.Convert.ToBoolean(ViewState["AddEventFormDisplay"]) == false) //only show once
                {
                    ViewState.Add("AddEventFormDisplay", true);
                    DateTime startDT = DateTime.Now.Date.AddHours(8);
                    if (Request.QueryString["startDT"] != null)
                    {
                        startDT = DateTime.ParseExact(Request.QueryString["startDT"], "yyyyMMddHHmm", new System.Globalization.CultureInfo(1033));
                    }
                    calendardisplay.ShowInsertForm(startDT);
                }
            }
            if (Request.QueryString["editEvent"] != null)
            {
                if (ViewState["editEvent"] == null || System.Convert.ToBoolean(ViewState["editEvent"]) == false) //only show once
                {
                    ViewState.Add("editEvent", true);
                    calendardisplay.ShowEditForm(Request.QueryString["editEvent"]);
                }
            }

            ScriptManager.RegisterClientScriptBlock(Page, typeof(UserControl), "CalendarCleanup", "try{ window.EditorCleanup(); }catch(ex){}", true);
        }
        _PagingPageSize = _ContentApi.RequestInformationRef.PagingSize;
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) == Ektron.Cms.Common.EkEnumeration.FolderType.Blog)
        {
            _BlogData = _ContentApi.BlogObject(_FolderData);
        }

        //if it's a calendar then we do it on prerender
        if ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType) != Ektron.Cms.Common.EkEnumeration.FolderType.Calendar)
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewArchiveContentInfov5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _EkContentCol = _EkContent.GetAllViewableChildContentInfoV5_0(_PageData, _PagingCurrentPageNumber, _PagingPageSize, ref _PagingTotalPagesNumber);
                _NextActionType = "ViewArchiveContentByCategory";
            }
            //paging goes here

            int i;
            for (i = 0; i <= _EkContentCol.Count - 1; i++)
            {
                if (_EkContentCol.get_Item(i).ContentStatus == "A")
                {
                    _TakeAction = true;
                    _CheckedInOrApproved = true;
                    break;
                }
                else
                {
                    if (_EkContentCol.get_Item(i).ContentStatus == "I")
                    {
                        _CheckedInOrApproved = true;
                    }
                }
            }
        }
        else
        {
            if (_PageAction == "viewarchivecontentbycategory")
            {
                _NextActionType = "ViewContentByCategory";
            }
            else if (_PageAction == "viewcontentbycategory")
            {
                _NextActionType = "ViewArchiveContentByCategory";
            }
        }

        switch ((Ektron.Cms.Common.EkEnumeration.FolderType)(_FolderData.FolderType))
        {
            case Ektron.Cms.Common.EkEnumeration.FolderType.Catalog:
                if (_PageAction == "viewarchivecontentbycategory")
                {
                    _NextActionType = "ViewContentByCategory";
                }
                else if (_PageAction == "viewcontentbycategory")
                {
                    _NextActionType = "ViewArchiveContentByCategory";
                }

                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");

                CatalogEntry CatalogManager = new CatalogEntry(_ContentApi.RequestInformationRef);
                System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
                Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

                entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _Id);
                entryCriteria.PagingInfo.CurrentPage = Convert.ToInt32(_PagingCurrentPageNumber.ToString());
                entryCriteria.PagingInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;

                if (_ContentApi.RequestInformationRef.ContentLanguage > 0)
                {
                    entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _ContentApi.RequestInformationRef.ContentLanguage);
                }

                switch (this._ContentTypeQuerystringParam)
                {
                    case "0":
                        long[] IdList = new long[3];
                        IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                        IdList[1] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct);
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                        break;
                    case "2":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Kit);
                        break;
                    case "3":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Bundle);
                        break;
                    case "4":
                        entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, Ektron.Cms.Common.EkEnumeration.CatalogEntryType.SubscriptionProduct);
                        break;
                }

                if (_PageAction == "viewarchivecontentbycategory")
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
                }
                else
                {
                    entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
                }
                if (Request.QueryString["orderbydirection"] == "desc")
                    direction = "desc";
                else
                    direction = "asc";
                if(direction == "desc")
                    entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Descending;
                else
                entryCriteria.OrderByDirection = (EkEnumeration.OrderByDirection)OrderByDirection.Ascending;

                switch (_OrderBy.ToLower())
                {
                    case "language":
                        entryCriteria.OrderByField = EntryProperty.LanguageId;
                        break;
                    case "id":
                        entryCriteria.OrderByField = EntryProperty.Id;
                        break;
                    case "status":
                        entryCriteria.OrderByField = EntryProperty.ContentStatus;
                        break;
                    case "entrytype":
                        entryCriteria.OrderByField = EntryProperty.EntryType;
                        break;
                    case "sale":
                        entryCriteria.OrderByField = EntryProperty.SalePrice;
                        break;
                    case "list":
                        entryCriteria.OrderByField = EntryProperty.ListPrice;
                        break;
                    default: //"title"
                        entryCriteria.OrderByField = EntryProperty.Title;
                        break;
                }

                entryList = CatalogManager.GetList(entryCriteria);

                for (int j = 0; j <= entryList.Count - 1; j++)
                {
                    if (entryList[j].Status == "A")
                    {
                        _TakeAction = true;
                        _CheckedInOrApproved = true;
                        break;
                    }
                    else
                    {
                        if (entryList[j].Status == "I")
                        {
                            _CheckedInOrApproved = true;
                        }
                    }
                }

                _PagingTotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

                //paging goes here

                ViewCatalogToolBar(entryList.Count);
                Populate_ViewCatalogGrid(_EkContentCol, entryList);
                _ContentType = int.Parse(_ContentTypeSelected);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Blog:
                _IsMyBlog = System.Convert.ToBoolean((_BlogData.Id == _ContentApi.GetUserBlog(_ContentApi.UserId)) ? true : false);
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _ContentData = _ContentApi.GetContentById(_PostID, 0);

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData = null;
                        _Comments = _Task.GetTasks(_PostID, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "postcomment", 0, ref null_EktronCmsPageRequestData, "");
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData2 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.BlogCommentItem), "", 0, ref null_EktronCmsPageRequestData2, "");
                    }
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogCommentsByCategoryGrid(_Comments);
                }
                else
                {
                    Hashtable BlogPostCommentTally = new Hashtable();
                    BlogPostCommentTally = _EkContent.TallyCommentsForBlogPosts(_Id);
                    ViewBlogContentByCategoryToolBar();
                    Populate_ViewBlogPostsByCategoryGrid(_EkContentCol, BlogPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Media:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewContentByCategoryToolBar();
                Populate_ViewMediaGrid(_EkContentCol);
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionBoard:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                ViewDiscussionBoardToolBar();
                Populate_ViewDiscussionBoardGrid();
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.DiscussionForum:
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "objselnotice", "<script type=\"text/javascript\">var objSelSupertype = null;</script>");
                bool bCanModerate = false;
                int itotalpages = 1;
                int icurrentpage = 1;
                if (!string.IsNullOrEmpty(Request.QueryString["ContType"]) && (Request.QueryString["ContType"] == Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments.ToString()))
                {
                    _ContentType = System.Convert.ToInt32(Request.QueryString["ContType"]);
                    if (this._ContentApi.UserId > 0 && ((!(_PermissionData == null) && _PermissionData.CanAddToImageLib == true) || _PermissionData.IsAdmin))
                    {
                        bCanModerate = true;
                    }
                    _DiscussionBoard = _ContentApi.GetTopic(_ContentId, true);
                    if (_DiscussionBoard == null)
                    {
                        throw new Exception("You may not have permission to view this object or it has been deleted.");
                    }
                    _BoardID = _DiscussionBoard.Id;
                    _ContentData = (ContentData)(_DiscussionBoard.Forums[0].Topics[0]);
                    _PermissionData = _ContentApi.LoadPermissions(_ContentId, "content", ContentAPI.PermissionResultType.All);
                    ViewRepliesToolBar();
                    _Task = _ContentApi.EkTaskRef;
                    if (!string.IsNullOrEmpty(Request.QueryString["contentid"]))
                    {
                        _PostID = Convert.ToInt64(Request.QueryString["contentid"]);
                        _Comments = _Task.GetTopicReplies(_PostID, _DiscussionBoard.Id, ref icurrentpage, 0, 0, ref itotalpages, bCanModerate);
                    }
                    else
                    {

                        Ektron.Cms.PageRequestData null_EktronCmsPageRequestData3 = null;
                        _Comments = _Task.GetTasks(-1, -1, -1, Convert.ToInt32(Ektron.Cms.Common.EkEnumeration.CMSTaskItemType.TopicReplyItem), "", 0, ref null_EktronCmsPageRequestData3, "");
                    }
                    Populate_ViewTopicRepliesGrid(_Comments);
                }
                else
                {
                    ArrayList ForumPostCommentTally = new ArrayList();
                    DiscussionBoard thisboard;
                    bool bModerator = false;
                    if (_PermissionData.IsAdmin == true || _PermissionData.CanAddToImageLib == true)
                    {
                        bModerator = true;
                    }
                    thisboard = _EkContent.GetForumbyID(_Id.ToString(), bModerator, _PagingCurrentPageNumber, ref this._PagingTotalPagesNumber, "", this._ContentApi.RequestInformationRef.PagingSize);

                    //paging here

                    ForumPostCommentTally = _EkContent.GetRepliesForTopics(_Id);
                    ViewDiscussionForumToolBar();
                    Populate_ViewForumPostsByCategoryGrid(thisboard.Forums[0].Topics, ForumPostCommentTally);
                }
                break;
            case Ektron.Cms.Common.EkEnumeration.FolderType.Calendar:
                ViewCalendarToolBar();
                break;
            default:
                ViewContentByCategoryToolBar();
                Populate_ViewContentByCategoryGrid(_EkContentCol);
                break;
        }

        Util_SetJs();
        return true;
    }
Exemple #35
0
    private void Display_ViewContent()
    {
        m_refMsg = m_refContentApi.EkMsgRef;
        bool bCanAlias = false;
        PermissionData security_task_data;
        StringBuilder sSummaryText;
        Ektron.Cms.UrlAliasing.UrlAliasManualApi m_aliasname = new Ektron.Cms.UrlAliasing.UrlAliasManualApi();
        Ektron.Cms.UrlAliasing.UrlAliasAutoApi m_autoaliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi();
        Ektron.Cms.Common.UrlAliasManualData d_alias;
        System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData> auto_aliaslist = new System.Collections.Generic.List<Ektron.Cms.Common.UrlAliasAutoData>();
        Ektron.Cms.UrlAliasing.UrlAliasSettingsApi m_urlAliasSettings = new Ektron.Cms.UrlAliasing.UrlAliasSettingsApi();
        int i;
        bool IsStagingServer;

        IsStagingServer = m_refContentApi.RequestInformationRef.IsStaging;

        security_task_data = m_refContentApi.LoadPermissions(m_intId, "tasks", ContentAPI.PermissionResultType.Task);
        security_data = m_refContentApi.LoadPermissions(m_intId, "content", ContentAPI.PermissionResultType.All);
        security_data.CanAddTask = security_task_data.CanAddTask;
        security_data.CanDestructTask = security_task_data.CanDestructTask;
        security_data.CanRedirectTask = security_task_data.CanRedirectTask;
        security_data.CanDeleteTask = security_task_data.CanDeleteTask;

        active_subscription_list = m_refContentApi.GetAllActiveSubscriptions();

        if ("viewstaged" == m_strPageAction)
        {
            ContentStateData objContentState;
            objContentState = m_refContentApi.GetContentState(m_intId);
            if ("A" == objContentState.Status)
            {
                // Can't view staged
                m_strPageAction = "view";
            }
        }
        try
        {
            if (m_strPageAction == "view")
            {
                content_data = m_refContentApi.GetContentById(m_intId, 0);
            }
            else if (m_strPageAction == "viewstaged")
            {
                content_data = m_refContentApi.GetContentById(m_intId, ContentAPI.ContentResultType.Staged);
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message), true);
            return;
        }

        if ((content_data != null) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(Convert.ToInt64 (content_data.Type), Convert.ToBoolean (-1))))
        {
            ContentPaneHeight = "700px";
        }
        //ekrw = m_refContentApi.EkUrlRewriteRef()
        //ekrw.Load()
        if (((m_urlAliasSettings.IsManualAliasEnabled || m_urlAliasSettings.IsAutoAliasEnabled) && m_refContentApi.IsARoleMember(Ektron.Cms.Common.EkEnumeration.CmsRoleIds.EditAlias)) && (content_data != null) && (content_data.AssetData != null) && !(Ektron.Cms.Common.EkFunctions.IsImage((string)("." + content_data.AssetData.FileExtension))))
        {
            bCanAlias = true;
        }

        blog_post_data = new BlogPostData();
        blog_post_data.Categories = (string[])Array.CreateInstance(typeof(string), 0);
        if (content_data.MetaData != null)
        {
            for (i = 0; i <= (content_data.MetaData.Length - 1); i++)
            {
                if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog categories")
                {
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&#39;", "\'");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&quot", "\"");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&gt;", ">");
                    content_data.MetaData[i].Text = content_data.MetaData[i].Text.Replace("&lt;", "<");
                    blog_post_data.Categories = Strings.Split((string)(content_data.MetaData[i].Text), ";", -1, 0);
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog pingback")
                {
                    if (!(content_data.MetaData[i].Text.Trim().ToLower() == "no"))
                    {
                        m_bIsBlog = true;
                    }
                    blog_post_data.Pingback = Ektron.Cms.Common.EkFunctions.GetBoolFromYesNo((string)(content_data.MetaData[i].Text));
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog tags")
                {
                    blog_post_data.Tags = (string)(content_data.MetaData[i].Text);
                }
                else if ((string)(content_data.MetaData[i].TypeName.ToLower()) == "blog trackback")
                {
                    blog_post_data.TrackBackURL = (string)(content_data.MetaData[i].Text);
                }
            }
        }

        //THE FOLLOWING LINES ADDED DUE TO TASK
        //:BEGIN / PROPOSED BY PAT
        //TODO: Need to recheck this part of the code e.r.
        if (content_data == null)
        {
            if (ContentLanguage != 0)
            {
                if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]))
                {
                    Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Strings.Replace(Request.ServerVariables["Query_String"], (string)("LangType=" + ContentLanguage), (string)("LangType=" + m_refContentApi.DefaultContentLanguage), 1, -1, 0)), false);
                    return;
                }
            }
            else
            {
                if (ContentLanguage.ToString() != (string)(Ektron.Cms.CommonApi.GetEcmCookie()["DefaultLanguage"]))
                {
                    Response.Redirect((string)(Request.ServerVariables["URL"] + "?" + Request.ServerVariables["Query_String"] + "&LangType=" + m_refContentApi.DefaultContentLanguage), false);
                    return;
                }
            }
        }
        //:END
        if (m_intFolderId == -1)
        {
            m_intFolderId = content_data.FolderId;
        }
        HoldMomentMsg.Text = m_refMsg.GetMessage("one moment msg");

        if ((active_subscription_list == null) || (active_subscription_list.Length == 0))
        {
            phWebAlerts.Visible = false;
            phWebAlerts2.Visible = false;
        }
        content_state_data = m_refContentApi.GetContentState(m_intId);

        jsFolderId.Text = m_intFolderId.ToString ();
        jsIsForm.Text = content_data.Type.ToString ();
        jsBackStr.Text = "back_file=content.aspx";
        if (m_strPageAction.Length > 0)
        {
            jsBackStr.Text += "&back_action=" + m_strPageAction;
        }
        if (Convert.ToString(m_intFolderId).Length > 0)
        {
            jsBackStr.Text += "&back_folder_id=" + m_intFolderId;
        }
        if (Convert.ToString(m_intId).Length > 0)
        {
            jsBackStr.Text += "&back_id=" + m_intId;
        }
        if (Convert.ToString((short)ContentLanguage).Length > 0)
        {
            jsBackStr.Text += "&back_LangType=" + ContentLanguage;
        }
        jsToolId.Text = m_intId.ToString ();
        jsToolAction.Text = m_strPageAction;
        jsLangId.Text = m_refContentApi.ContentLanguage.ToString ();
        if (content_data.Type == 3333)
        {
            ViewCatalogToolBar();
        }
        else
        {
            ViewToolBar();
        }

        if (bCanAlias && content_data.SubType != Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) //And folder_data.FolderType <> 1 Don't Show alias tab for Blogs.
        {
            string m_strAliasPageName = "";

            d_alias = m_aliasname.GetDefaultAlias(content_data.Id);
            if (d_alias.QueryString != "")
            {
                m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension + d_alias.QueryString; //content_data.ManualAlias
            }
            else
            {
                m_strAliasPageName = d_alias.AliasName + d_alias.FileExtension; //content_data.ManualAlias
            }

            if (m_strAliasPageName != "")
            {

                if (IsStagingServer && folder_data.DomainStaging != string.Empty)
                {
                    m_strAliasPageName = (string)("http://" + folder_data.DomainStaging + "/" + m_strAliasPageName);
                }
                else if (folder_data.IsDomainFolder)
                {
                    m_strAliasPageName = (string)("http://" + folder_data.DomainProduction + "/" + m_strAliasPageName);
                }
                else
                {
                    m_strAliasPageName = SitePath + m_strAliasPageName;
                }
                m_strAliasPageName = "<a href=\"" + m_strAliasPageName + "\" target=\"_blank\" >" + m_strAliasPageName + "</a>";
            }
            else
            {
                m_strAliasPageName = " [Not Defined]";
            }
            tdAliasPageName.InnerHtml = m_strAliasPageName;
        }
        else
        {
            phAliases.Visible = false;
            phAliases2.Visible = false;
        }
        auto_aliaslist = m_autoaliasApi.GetListForContent(content_data.Id);
        autoAliasList.InnerHtml = "<div class=\"ektronHeader\">" + m_refMsg.GetMessage("lbl automatic") + "</div>";
        autoAliasList.InnerHtml += "<div class=\"ektronBorder\">";
        autoAliasList.InnerHtml += "<table width=\"100%\">";
        autoAliasList.InnerHtml += "<tr class=\"title-header\">";
        autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("generic type") + "</th>";
        autoAliasList.InnerHtml += "<th>" + m_refMsg.GetMessage("lbl alias name") + "</th>";
        autoAliasList.InnerHtml += "</tr>";
        for (i = 0; i <= auto_aliaslist.Count() - 1; i++)
        {
            autoAliasList.InnerHtml += "<tr class=\"row\">";
            if (auto_aliaslist[i].AutoAliasType == Ektron.Cms.Common.EkEnumeration.AutoAliasType.Folder)
            {
                autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/folder.png\"  alt=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("lbl folder") + "\"/ ></td>";
            }
            else
            {
                autoAliasList.InnerHtml += "<td><img src =\"" + m_refContentApi.AppPath + "images/UI/Icons/taxonomy.png\"  alt=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\" title=\"" + m_refContentApi.EkMsgRef.GetMessage("generic taxonomy lbl") + "\"/ ></td>";
            }

            if (IsStagingServer && folder_data.DomainStaging != string.Empty)
            {
                autoAliasList.InnerHtml = autoAliasList.InnerHtml + "<td> <a href = \"http://" + folder_data.DomainStaging + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td></tr>";
            }
            else if (folder_data.IsDomainFolder)
            {
                autoAliasList.InnerHtml += "<td> <a href = \"http://" + folder_data.DomainProduction + "/" + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>";
            }
            else
            {
                autoAliasList.InnerHtml += "<td> <a href = \"" + SitePath + auto_aliaslist[i].AliasName + "\" target=\"_blank\" >" + auto_aliaslist[i].AliasName + " </a></td>";
            }
            autoAliasList.InnerHtml += "</tr>";
        }
        autoAliasList.InnerHtml += "</table>";
        autoAliasList.InnerHtml += "</div>";
        if (content_data == null)
        {
            content_data = m_refContentApi.GetContentById(m_intId, 0);
        }
        if (content_data.Type == 3333)
        {
            m_refCatalog = new CatalogEntry(m_refContentApi.RequestInformationRef);
            m_refCurrency = new Currency(m_refContentApi.RequestInformationRef);
            //m_refMedia = MediaData()
            entry_edit_data = m_refCatalog.GetItemEdit(m_intId, ContentLanguage, false);

            Ektron.Cms.Commerce.ProductType m_refProductType = new Ektron.Cms.Commerce.ProductType(m_refContentApi.RequestInformationRef);
            prod_type_data = m_refProductType.GetItem(entry_edit_data.ProductType.Id, true);

            if (prod_type_data.Attributes.Count == 0)
            {
                phAttributes.Visible = false;
                phAttributes2.Visible = false;
            }

            Display_PropertiesTab(content_data);
            Display_PricingTab();
            Display_ItemTab();
            Display_MetadataTab();
            Display_MediaTab();
        }
        else
        {
            ViewContentProperties(content_data);
            phCommerce.Visible = false;
            phCommerce2.Visible = false;
            phItems.Visible = false;
        }

        bool bPackageDisplayXSLT = false;
        string CurrentXslt = "";
        int XsltPntr;

        if ((!(content_data.XmlConfiguration == null)) && (content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_CatalogEntry || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Content || content_data.Type == Ektron.Cms.Common.EkConstants.CMSContentType_Forms))
        {
            if (!(content_data.XmlConfiguration == null))
            {
                if (content_data.XmlConfiguration.DefaultXslt.Length > 0)
                {
                    if (content_data.XmlConfiguration.DefaultXslt == "0")
                    {
                        bPackageDisplayXSLT = true;
                    }
                    else
                    {
                        bPackageDisplayXSLT = false;
                    }
                    if (!bPackageDisplayXSLT)
                    {
                        XsltPntr = int.Parse(content_data.XmlConfiguration.DefaultXslt);
                        if (XsltPntr > 0)
                        {
                            Collection tmpXsltColl = (Collection)content_data.XmlConfiguration.PhysPathComplete;
                            if (tmpXsltColl["Xslt" + XsltPntr] != null)
                            {
                                CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]);
                            }
                            else
                            {
                                tmpXsltColl = (Collection)content_data.XmlConfiguration.LogicalPathComplete;
                                CurrentXslt = (string)(tmpXsltColl["Xslt" + XsltPntr]);
                            }
                        }
                    }
                }
                else
                {
                    bPackageDisplayXSLT = true;
                }
                //End If

                Ektron.Cms.Xslt.ArgumentList objXsltArgs = new Ektron.Cms.Xslt.ArgumentList();
                objXsltArgs.AddParam("mode", string.Empty, "preview");
                if (bPackageDisplayXSLT)
                {
                    divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, content_data.XmlConfiguration.PackageDisplayXslt, false, false, objXsltArgs, true, true);
                }
                else
                {
                    // CurrentXslt is always obtained from the object in the database.
                    divContentHtml.InnerHtml = m_refContentApi.XSLTransform(content_data.Html, CurrentXslt, true, false, objXsltArgs, true, true);
                }
            }
            else
            {
                divContentHtml.InnerHtml = content_data.Html;
            }
        }
        else
        {
            if (content_data.Type == 104)
            {
                media_html.Value = content_data.MediaText;
                //Get Url from content
                string tPath = m_refContentApi.RequestInformationRef.AssetPath + m_refContentApi.EkContentRef.GetFolderParentFolderIdRecursive(content_data.FolderId).Replace(",", "/") + "/" + content_data.AssetData.Id + "." + content_data.AssetData.FileExtension;
                string mediaHTML = FixPath(content_data.Html, tPath);
                int scriptStartPtr = 0;
                int scriptEndPtr = 0;
                int len = 0;
                //Registering the javascript & CSS
                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "linkReg", "<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", false);
                mediaHTML = mediaHTML.Replace("<link href=\"" + m_refContentApi.ApplicationPath + "csslib/EktTabs.css\" rel=\"stylesheet\" type=\"text/css\" />", "");
                while (1 == 1)
                {
                    scriptStartPtr = mediaHTML.IndexOf("<script", scriptStartPtr);
                    scriptEndPtr = mediaHTML.IndexOf("</script>", scriptEndPtr);
                    if (scriptStartPtr == -1 || scriptEndPtr == -1)
                    {
                        break;
                    }
                    len = scriptEndPtr - scriptStartPtr + 9;
                    this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), (string)("scriptreg" + scriptEndPtr), mediaHTML.Substring(scriptStartPtr, len), false);
                    mediaHTML = mediaHTML.Replace(mediaHTML.Substring(scriptStartPtr, len), "");
                    scriptStartPtr = 0;
                    scriptEndPtr = 0;
                }
                media_display_html.Value = mediaHTML;
                divContentHtml.InnerHtml = "<a href=\"#\" onclick=\"document.getElementById(\'" + divContentHtml.ClientID + "\').innerHTML = document.getElementById(\'" + media_display_html.ClientID + "\').value;return false;\" alt=\"" + m_refMsg.GetMessage("alt show media content") + "\" title=\"" + m_refMsg.GetMessage("alt show media content") + "\">" + m_refMsg.GetMessage("lbl show media content") + "<br/><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/filmstrip_ph.jpg\" /></a>";
            }
            else
            {
                if (Ektron.Cms.Common.EkConstants.IsAssetContentType(content_data.Type, Convert .ToBoolean (-1)))
                {
                    string ver = "";
                    ver = (string)("&version=" + content_data.AssetData.Version);
                    if (IsImage(content_data.AssetData.Version))
                    {
                        divContentHtml.InnerHtml = "<img src=\"" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\" />";
                    }
                    else
                    {
                        divContentHtml.InnerHtml = "<div align=\"center\" style=\"padding:15px;\"><a style=\"text-decoration:none;\" href=\"#\" onclick=\"javascript:window.open(\'" + m_refContentApi.SitePath + "assetmanagement/DownloadAsset.aspx?ID=" + content_data.AssetData.Id + ver + "\',\'DownloadAsset\',\'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=1000,height=800\');return false;\"><img align=\"middle\" src=\"" + m_refContentApi.AppPath + "images/application/download.gif\" />" + m_refMsg.GetMessage("btn download") + " &quot;" + content_data.Title + "&quot;</a></div>";
                    }

                }
                else if (content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
                {
                    Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon();
                    FolderData fd = this.m_refContentApi.GetFolderById(content_data.FolderId);
                    string stralias = u.GetAliasForContent(content_data.Id);
                    if (stralias == string.Empty || fd.IsDomainFolder)
                    {
                        stralias = content_data.Quicklink;
                    }

                    string link = "";
                    if (content_data.ContType == (int)EkEnumeration.CMSContentType.Content || (content_data.ContType == (int)EkEnumeration.CMSContentType.Archive_Content && content_data.EndDateAction != 1))
                    {
                        string url = this.m_refContent.RequestInformation.SitePath + stralias;
                        if (url.Contains("?"))
                        {
                            url += "&";
                        }
                        else
                        {
                            url += "?";
                        }
                        if ("viewstaged" == m_strPageAction)
                        {
                            url += "view=staged";
                        }
                        else
                        {
                            url += "view=published";
                        }
                        url += (string)("&LangType=" + content_data.LanguageId.ToString());
                        link = "<a href=\"" + url + "\" onclick=\"window.open(this.href);return false;\">Click here to view the page</a><br/><br/>";
                    }
                    divContentHtml.InnerHtml = link + Ektron.Cms.PageBuilder.PageData.RendertoString(content_data.Html);
                }
                else
                {
                    if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type)
                    {
                        divContentHtml.InnerHtml = content_data.Html.Replace("[srcpath]", m_refContentApi.ApplicationPath + m_refContentApi.AppeWebPath);
                        divContentHtml.InnerHtml = divContentHtml.InnerHtml.Replace("[skinpath]", m_refContentApi.ApplicationPath + "csslib/ContentDesigner/");
                    }
                    else
                    {
                        divContentHtml.InnerHtml = content_data.Html;
                    }
                    if (m_bIsBlog)
                    {
                        Collection blogData = m_refContentApi.EkContentRef.GetBlogData(content_data.FolderId);
                        if (blogData != null)
                        {
                            if (blogData["enablecomments"].ToString() != string.Empty)
                            {
                                litBlogComment.Text = "<div class=\"ektronTopSpace\"></div><a class=\"button buttonInline greenHover buttonNoIcon\" href=\"" + m_refContentApi.AppPath + "content.aspx?id=" + content_data.FolderId + "&action=ViewContentByCategory&LangType=" + content_data.LanguageId + "&ContType=" + Ektron.Cms.Common.EkConstants.CMSContentType_BlogComments + "&contentid=" + content_data.Id + "&viewin=" + content_data.LanguageId + "\" title=\"" + m_refMsg.GetMessage("alt view comments label") + "\">" + m_refMsg.GetMessage("view comments") + "</a>";
                                litBlogComment.Visible = true;
                            }
                        }
                    }
                }
            }
        }

        sSummaryText = new StringBuilder();
        if ((int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms == content_data.Type || (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Archive_Forms == content_data.Type)
        {
            if (content_data.Teaser != null)
            {
                if (content_data.Teaser.IndexOf("<ektdesignpackage_design") > -1)
                {
                    string strDesign;
                    strDesign = m_refContentApi.XSLTransform(null, null, true, false, null, true);
                    tdsummarytext.InnerHtml = strDesign;
                }
                else
                {
                    tdsummarytext.InnerHtml = content_data.Teaser;
                }
            }
            else
            {
                tdsummarytext.InnerHtml = "";
            }
        }
        else
        {
            if (m_bIsBlog)
            {
                sSummaryText.AppendLine("<table class=\"ektronGrid\">");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td valign=\"top\" class=\"label\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("generic description") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td valign=\"top\">");
            }
            sSummaryText.AppendLine(content_data.Teaser);
            if (m_bIsBlog)
            {
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td valign=\"top\" class=\"label\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("lbl blog cat") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td>");
                if (!(blog_post_data.Categories == null))
                {
                    arrBlogPostCategories = blog_post_data.Categories;
                    if (arrBlogPostCategories.Length > 0)
                    {
                        Array.Sort(arrBlogPostCategories);
                    }
                }
                else
                {
                    arrBlogPostCategories = null;
                }
                if (blog_post_data.Categories.Length > 0)
                {
                    for (i = 0; i <= (blog_post_data.Categories.Length - 1); i++)
                    {
                        if (blog_post_data.Categories[i].ToString() != "")
                        {
                            sSummaryText.AppendLine("				<input type=\"checkbox\" name=\"blogcategories" + i.ToString() + "\" value=\"" + blog_post_data.Categories[i].ToString() + "\" checked=\"true\" disabled>&nbsp;" + Strings.Replace((string)(blog_post_data.Categories[i].ToString()), "~@~@~", ";", 1, -1, 0) + "<br />");
                        }
                    }
                }
                else
                {
                    sSummaryText.AppendLine("No categories defined.");
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("		<td class=\"label\" valign=\"top\">");
                sSummaryText.AppendLine("			" + m_refMsg.GetMessage("lbl personal tags") + "");
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("		<td>");
                if (!(blog_post_data == null))
                {
                    sSummaryText.AppendLine(blog_post_data.Tags);
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("	<tr>");
                sSummaryText.AppendLine("	    <td class=\"label\">");
                if (!(blog_post_data == null))
                {
                    sSummaryText.AppendLine("   <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"" + blog_post_data.TrackBackURLID.ToString() + "\" />");
                    sSummaryText.AppendLine("   <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + "");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("		<td>");
                    sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"" + EkFunctions.HtmlEncode(blog_post_data.TrackBackURL) + "\" disabled/>");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("	</tr>");
                    sSummaryText.AppendLine("	<tr>");
                    sSummaryText.AppendLine("		<td class=\"label\">");
                    if (blog_post_data.Pingback == true)
                    {
                        sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                        sSummaryText.AppendLine("		</td>");
                        sSummaryText.AppendLine("		<td>");
                        sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" checked disabled/>");

                    }
                    else
                    {
                        sSummaryText.AppendLine("" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                        sSummaryText.AppendLine("		</td>");
                        sSummaryText.AppendLine("		<td>");
                        sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>");
                    }
                }
                else
                {
                    sSummaryText.AppendLine("           <input type=\"hidden\" name=\"blogposttrackbackid\" id=\"blogposttrackbackid\" value=\"\" />");
                    sSummaryText.AppendLine("           <input type=\"hidden\" id=\"isblogpost\" name=\"isblogpost\" value=\"true\"/>" + m_refMsg.GetMessage("lbl trackback url") + "");
                    sSummaryText.AppendLine("<input type=\"text\" size=\"75\" id=\"trackback\" name=\"trackback\" value=\"\" disabled/>");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("	</tr>");
                    sSummaryText.AppendLine("	<tr>");
                    sSummaryText.AppendLine("		<td class=\"label\">" + m_refMsg.GetMessage("lbl blog ae ping") + "");
                    sSummaryText.AppendLine("		</td>");
                    sSummaryText.AppendLine("		<td>");
                    sSummaryText.AppendLine("           <input type=\"checkbox\" name=\"pingback\" id=\"pingback\" disabled/>");
                }
                sSummaryText.AppendLine("		</td>");
                sSummaryText.AppendLine("	</tr>");
                sSummaryText.AppendLine("</table>");
            }
            tdsummarytext.InnerHtml = sSummaryText.ToString();
        }

        ViewMetaData(content_data);

        tdcommenttext.InnerHtml = content_data.Comment;
        AddTaskTypeDropDown();
        ViewTasks();
        ViewSubscriptions();
        Ektron.Cms.Content.EkContent cref;
        cref = m_refContentApi.EkContentRef;
        TaxonomyBaseData[] dat;
        dat = cref.GetAllFolderTaxonomy(folder_data.Id);
        if (dat == null || dat.Length == 0)
        {
            phCategories.Visible = false;
            phCategories2.Visible = false;
        }
        ViewAssignedTaxonomy();
        if ((content_data != null) && ((content_data.Type >= EkConstants.ManagedAsset_Min && content_data.Type <= EkConstants.ManagedAsset_Max && content_data.Type != 104) || (content_data.Type >= EkConstants.Archive_ManagedAsset_Min && content_data.Type <= EkConstants.Archive_ManagedAsset_Max && content_data.Type != 1104) || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderData || content_data.SubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData))
        {
            showAlert = false;
        }
        if (
            (Request.QueryString["menuItemType"] != null && Request.QueryString["menuItemType"].ToLower() == "viewproperties")
            ||
            (Request.QueryString["tab"] != null && Request.QueryString["tab"].ToLower() == "properties")
            )
        {
            DefaultTab.Value = "dvProperties";
            Util_ReloadTree(content_data.Path, content_data.FolderId);
        }
    }
    private void Display_DeleteEntries()
    {
        CatalogEntry CatalogManager = new CatalogEntry(_ContentApi.RequestInformationRef);
            System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
            Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

            entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _Id);
            if (_ContentApi.RequestInformationRef.ContentLanguage > 0)
            {
                entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _ContentApi.RequestInformationRef.ContentLanguage);
            }

            entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
            entryCriteria.OrderByField = EntryProperty.Title;

            entryCriteria.PagingInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            entryCriteria.PagingInfo.CurrentPage = _CurrentPageId;

            if (_ShowArchive == false)
            {
                entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
            }
            else
            {
                entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
            }

            entryList = CatalogManager.GetList(entryCriteria);

            _TotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

            DeleteContentByCategoryToolBar();

            PageSettings();

            Populate_DeleteCatalogGrid(entryList);

            folder_id.Value =Convert.ToString(_Id);
    }
 private void ReadEmaster(List<CatalogEntry> MainDir, string path)        
 {
    string EMasterName = path+"\\EMASTER";
    if(!File.Exists(EMasterName)) return;
    
    // reads header structure          
    FileStream F = new FileStream(EMasterName, FileMode.Open, FileAccess.Read);          
    BinaryReader BR = new BinaryReader(F);          
                       
    // reads header
    int num_files = BR.ReadUInt16();   // number of files in emaster 
    int file_num = BR.ReadUInt16();    // last (highest) file number           
    BR.ReadBytes(188);                 // [188]
                        
    for(int t=0;t<num_files;t++)
    {
        CatalogEntry DE = new CatalogEntry();             
        BR.ReadBytes(2); // char asc30[2] = "30"
        DE.filename = String.Format("{1}\\F{0}.dat",BR.ReadByte(),path); // file number F# 
        BR.ReadBytes(3); // filler
        DE.numfields = (int) BR.ReadByte();   // u_char num_fields;	    number of 4-byte data fields 
        if(DE.numfields==0) DE.numfields=7;   // in some files 0 means "default" 7 fields
        BR.ReadBytes(2); // filler
        BR.ReadBytes(1); // char flag;		          /* ' ' or '*' for autorun 
        BR.ReadBytes(1); // filler 
        DE.symbol = AsciiString(BR.ReadBytes(14)); // stock symbol 
        BR.ReadBytes(7); // filler 
        DE.stockname = AsciiString(BR.ReadBytes(16)).Trim(); // stock name
        BR.ReadBytes(12); // filler  
        DE.timeframe = AsciiString(BR.ReadBytes(1));  // data format: 'D'/'W'/'M'/ etc. 
        BR.ReadBytes(3); // filler
        BR.ReadSingle(); //DE.StartDate = DateFromSingle(BR.ReadSingle());                                           
        BR.ReadBytes(4); // filler  
        BR.ReadSingle(); //DE.EndDate = DateFromSingle(BR.ReadSingle());               
        BR.ReadBytes(116); // filler                
        MainDir.Add(DE);          
    }
              
    BR.Close();                     
    F.Close();          
 }
 private void ReadXmaster(List<CatalogEntry> MainDir, string path)        
 {
    string XMasterName = path+"\\XMASTER";
    if(!File.Exists(XMasterName)) return;
    
    // reads header structure          
    FileStream F = new FileStream(XMasterName, FileMode.Open, FileAccess.Read);          
    BinaryReader BR = new BinaryReader(F);          
                       
    // reads header
    BR.ReadBytes(10); // filler
    int num_files = BR.ReadUInt16();   // number of files in emaster                  
    BR.ReadBytes(138);                 // filler
                        
    for(int t=0;t<num_files;t++)
    {
        CatalogEntry DE = new CatalogEntry();              
        BR.ReadBytes(1); // unknown
        DE.symbol = AsciiString(BR.ReadBytes(15)); // stock symbol 
        DE.stockname = AsciiString(BR.ReadBytes(46)).Trim(); // stock name
        DE.numfields = 7;
        DE.timeframe = AsciiString(BR.ReadBytes(1));  // data format: 'D'/'W'/'M'/ etc.               
        BR.ReadBytes(2); // unknown
        DE.filename = String.Format("{1}\\F{0}.mwd",BR.ReadUInt16(),path); // file number F#               
        BR.ReadBytes(13); // filler
        BR.ReadUInt32();  // dividend date?                           
        BR.ReadBytes(20); // filler
        BR.ReadUInt32();  // last split date?            
        DE.StartDate = DateFromInt(BR.ReadUInt32()); // start date again?
        BR.ReadBytes(4); // unknown
        DE.EndDate = DateFromInt(BR.ReadUInt32()); // enddate again?
        BR.ReadBytes(30); // unknown
        MainDir.Add(DE);          
    }
              
    BR.Close();                     
    F.Close();          
 }
Exemple #39
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        base.Page_Load(sender, e);
        Utilities.ValidateUserLogin();
        if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
        {
            Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error"));
        }
        CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef);
        System.Collections.Generic.List<CatalogData> catalogData = new System.Collections.Generic.List<CatalogData>();

        TotalPages.Visible = false;
        CurrentPage.Visible = false;
        PageLabel.Visible = false;
        OfLabel.Visible = false;

        switch (m_sPageAction)
        {
            case "crosssellselect":
            case "upsellselect":
            case "couponselect":
            case "select":
            case "reportingselect":
                Display_ViewAll();
                break;
            default:
                catalogData = CatalogManager.GetCatalogList(1, 1);
                populateFolder(catalogData);
                break;
        }
    }
Exemple #40
0
 private void AddPluralsTranslations(CatalogEntry entry)
 {
     // Creating 2 plurals forms by default
     // Translator should change it using expression for it own country
     // http://translate.sourceforge.net/wiki/l10n/pluralforms
     List<string> translations = new List<string>();
     for (int i = 0; i < Catalog.PluralFormsCount; i++)
         translations.Add("");
     entry.SetTranslations(translations.ToArray());
 }
Exemple #41
0
        private void MergeWithEntry(
            string context,
            string msgid,
            string msgidPlural,
            string inputFile,
            int line)
        {
            // Processing
            CatalogEntry entry = Catalog.FindItem(msgid, context);
            bool entryFound = entry != null;
            if (!entryFound)
                entry = new CatalogEntry(Catalog, msgid, msgidPlural);

            // Add source reference if it not exists yet
            // Each reference is in the form "path_name:line_number"
            string sourceRef = String.Format("{0}:{1}",
                                             Utils.FileUtils.GetRelativeUri(Path.GetFullPath(inputFile), Path.GetFullPath(Options.OutFile)),
                                             line);
            entry.AddReference(sourceRef); // Wont be added if exists

            if (FormatValidator.IsFormatString(msgid) || FormatValidator.IsFormatString(msgidPlural))
            {
                if (!entry.IsInFormat("csharp"))
                    entry.Flags += ", csharp-format";
                Trace.WriteLineIf(
                    !FormatValidator.IsValidFormatString(msgid),
                    String.Format("Warning: string format may be invalid: '{0}'\nSource: {1}", msgid, sourceRef));
                Trace.WriteLineIf(
                    !FormatValidator.IsValidFormatString(msgidPlural),
                    String.Format("Warning: plural string format may be invalid: '{0}'\nSource: {1}", msgidPlural, sourceRef));
            }

            if (!String.IsNullOrEmpty(msgidPlural))
            {
                if (!entryFound)
                {
                    AddPluralsTranslations(entry);
                }
                else
                    UpdatePluralEntry(entry, msgidPlural);
            }
            if (!String.IsNullOrEmpty(context))
            {
                entry.Context = context;
                entry.AddAutoComment(String.Format("Context: {0}", context), true);
            }

            if (!entryFound)
                Catalog.AddItem(entry);
        }
Exemple #42
0
 private void UpdatePluralEntry(CatalogEntry entry, string msgidPlural)
 {
     if (!entry.HasPlural)
     {
         AddPluralsTranslations(entry);
         entry.SetPluralString(msgidPlural);
     }
     else if (entry.HasPlural && entry.PluralString != msgidPlural)
     {
         entry.SetPluralString(msgidPlural);
     }
 }