コード例 #1
0
    /// <summary>
    /// Returns URL of item according specified conditions.
    /// </summary>
    /// <param name="data">Data object holding information on item</param>
    /// <param name="isPreview">Indicates whether the URL is requested for item preview</param>
    /// <param name="height">Image height</param>
    /// <param name="width">Image width</param>
    /// <param name="maxSideSize">Specifies maximum size of the image</param>
    /// <param name="notAttachment">Indicates whether the file is attachment</param>
    private IconParameters innermedia_GetThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        IconParameters parameters = new IconParameters();

        if (LibraryInfo != null)
        {
            // get argument set
            string arg = GetArgumentSet(data);

            // Get extension
            string ext = data.GetValue((data.ContainsColumn("FileExtension") ? "FileExtension" : "Extension")).ToString();

            // If image is requested for preview
            if (isPreview)
            {
                if (ext.ToLowerCSafe() == "<dir>")
                {
                    parameters.IconClass = "icon-folder";
                }
                else
                {
                    // Check if file has a preview
                    if (!ImageHelper.IsSupportedByImageEditor(ext))
                    {
                        // File isn't image and no preview exists - get the default file icon
                        parameters.IconClass = UIHelper.GetFileIconClass(ext);
                    }
                    else
                    {
                        // Files are obtained from the FS
                        if (!data.ContainsColumn("FileURL"))
                        {
                            parameters.Url = GetItemUrl(arg, true, height, width, maxSideSize);
                        }
                        else
                        {
                            parameters.IconClass = UIHelper.GetFileIconClass(ext);
                        }
                    }
                }

                // Setup icon size for fon icons
                if (!string.IsNullOrEmpty(parameters.IconClass))
                {
                    parameters.IconSize = FontIconSizeEnum.Dashboard;
                }
            }
            else
            {
                // Get item URL
                parameters.Url = GetItemUrlInternal(arg, data, false, height, width, maxSideSize, notAttachment);
            }
        }
        return(parameters);
    }
コード例 #2
0
    private IconParameters innermedia_GetThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        IconParameters parameters = new IconParameters();

        string ext = (SourceType != MediaSourceEnum.MetaFile) ? data.GetValue("AttachmentExtension").ToString() : data.GetValue("MetaFileExtension").ToString();
        string arg = GetArgumentSet(data);

        // If image is requested for preview
        if (isPreview)
        {
            if (!ImageHelper.IsImage(ext) || notAttachment)
            {
                string className = (SourceType == MediaSourceEnum.Content) ? data.GetValue("ClassName").ToString().ToLowerCSafe() : "";
                if (className == "cms.file")
                {
                    // File isn't image and no preview exists - get default file icon
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else if (((SourceType == MediaSourceEnum.DocumentAttachments) || (SourceType == MediaSourceEnum.Attachment) || (SourceType == MediaSourceEnum.MetaFile)) && !String.IsNullOrEmpty(ext))
                {
                    // Get file icon for attachment
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else
                {
                    var dataClass = DataClassInfoProvider.GetDataClassInfo(className);
                    parameters.Url = UIHelper.GetDocumentTypeIconUrl(Page, className, "48x48");

                    if (dataClass != null)
                    {
                        parameters.IconClass = (string)dataClass.GetValue("ClassIconClass");
                    }
                }

                // Set font icon size
                if (!string.IsNullOrEmpty(parameters.IconClass))
                {
                    parameters.IconSize = FontIconSizeEnum.Dashboard;
                }
            }
            else
            {
                // Try to get preview or image itself
                parameters.Url = GetItemUrl(arg, height, width, maxSideSize, notAttachment);
            }
        }
        else
        {
            parameters.Url = GetItemUrl(arg, 0, 0, 0, notAttachment);
        }

        return(parameters);
    }
コード例 #3
0
    /// <summary>
    /// Returns URL of item according specified conditions.
    /// </summary>
    /// <param name="data">Data object holding information on item</param>
    /// <param name="isPreview">Indicates whether the URL is requested for item preview</param>
    /// <param name="height">Image height</param>
    /// <param name="width">Image width</param>
    /// <param name="maxSideSize">Specifies maximum size of the image</param>
    /// <param name="notAttachment">Indicates whether the file is attachment</param>
    private IconParameters innermedia_GetThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        IconParameters parameters = new IconParameters();

        if (LibraryInfo != null)
        {
            // get argument set
            string arg = GetArgumentSet(data);

            // Get extension
            string ext = data.GetValue((data.ContainsColumn("FileExtension") ? "FileExtension" : "Extension")).ToString();

            // If image is requested for preview
            if (isPreview)
            {
                if (ext.ToLowerCSafe() == "<dir>")
                {
                    parameters.IconClass = "icon-folder";
                }
                else
                {
                    // Check if file has a preview
                    if (!ImageHelper.IsSupportedByImageEditor(ext))
                    {
                        // File isn't image and no preview exists - get the default file icon
                        parameters.IconClass = UIHelper.GetFileIconClass(ext);
                    }
                    else
                    {
                        // Files are obtained from the FS
                        if (!data.ContainsColumn("FileURL"))
                        {
                            parameters.Url = GetItemUrl(arg, true, height, width, maxSideSize);
                        }
                        else
                        {
                            parameters.IconClass = UIHelper.GetFileIconClass(ext);
                        }
                    }
                }

                // Setup icon size for fon icons
                if (!string.IsNullOrEmpty(parameters.IconClass))
                {
                    parameters.IconSize = FontIconSizeEnum.Dashboard;
                }
            }
            else
            {
                // Get item URL
                parameters.Url = GetItemUrlInternal(arg, data, false, height, width, maxSideSize, notAttachment);
            }
        }
        return parameters;
    }
コード例 #4
0
    private IconParameters innermedia_GetThumbsItemUrl(IDataContainer data, bool isPreview, int height, int width, int maxSideSize, bool notAttachment)
    {
        IconParameters parameters = new IconParameters();

        string ext = (SourceType != MediaSourceEnum.MetaFile) ? data.GetValue("AttachmentExtension").ToString() : data.GetValue("MetaFileExtension").ToString();
        string arg = GetArgumentSet(data);

        // If image is requested for preview
        if (isPreview)
        {
            if (!ImageHelper.IsImage(ext) || notAttachment)
            {
                string className = (SourceType == MediaSourceEnum.Content) ? data.GetValue("ClassName").ToString().ToLowerCSafe() : "";
                if (className == "cms.file")
                {
                    // File isn't image and no preview exists - get default file icon
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else if (((SourceType == MediaSourceEnum.DocumentAttachments) || (SourceType == MediaSourceEnum.Attachment) || (SourceType == MediaSourceEnum.MetaFile)) && !String.IsNullOrEmpty(ext))
                {
                    // Get file icon for attachment
                    parameters.IconClass = UIHelper.GetFileIconClass(ext);
                }
                else
                {
                    var dataClass = DataClassInfoProvider.GetDataClassInfo(className);
                    parameters.Url = UIHelper.GetDocumentTypeIconUrl(Page, className, "48x48");

                    if (dataClass != null)
                    {
                        parameters.IconClass = (string)dataClass.GetValue("ClassIconClass");
                    }
                }

                // Set font icon size
                if (!string.IsNullOrEmpty(parameters.IconClass))
                {
                    parameters.IconSize = FontIconSizeEnum.Dashboard;
                }
            }
            else
            {
                // Try to get preview or image itself
                parameters.Url = GetItemUrl(arg, height, width, maxSideSize, notAttachment);
            }
        }
        else
        {
            parameters.Url = GetItemUrl(arg, 0, 0, 0, notAttachment);
        }

        return parameters;
    }