コード例 #1
0
        protected void AssetTypeFileExtensionsRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (GeneralUtils.ValueIsInList(e.Item.ItemType, ListItemType.Item, ListItemType.AlternatingItem))
            {
                AssetTypeFileExtension o = (AssetTypeFileExtension)e.Item.DataItem;

                Image IconImage = (Image)e.Item.FindControl("IconImage");
                IconImage.ImageUrl = SiteUtils.GetFileTypeImageUrl(o.Extension);

                Literal APSSupportedLiteral = (Literal)e.Item.FindControl("APSSupportedLiteral");
                APSSupportedLiteral.Text = APSGateway.Instance.CanProcess(o.Extension) ? "Y" : "N";
            }
        }
コード例 #2
0
        protected void SearchResultListRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case (ListItemType.Item):
            case (ListItemType.AlternatingItem):

                Asset asset = (Asset)e.Item.DataItem;

                AssetButtons AssetButtons1       = (AssetButtons)e.Item.FindControl("AssetButtons1");
                Image        FileTypeIconImage   = (Image)e.Item.FindControl("FileTypeIconImage");
                HyperLink    ReferenceHyperLink  = (HyperLink)e.Item.FindControl("ReferenceHyperLink");
                HyperLink    TitleHyperLink      = (HyperLink)e.Item.FindControl("TitleHyperLink");
                Label        ProductionDateLabel = (Label)e.Item.FindControl("ProductionDateLabel");
                Label        FileSizeLabel       = (Label)e.Item.FindControl("FileSizeLabel");
                Label        AssetTypeLabel      = (Label)e.Item.FindControl("AssetTypeLabel");

                AssetButtons1.LightboxId = PersistentCartLightbox.SelectedLightboxId;
                AssetButtons1.Initialise(asset);

                FileTypeIconImage.ImageUrl = SiteUtils.GetFileTypeImageUrl(asset.FileExtension);
                FileTypeIconImage.ToolTip  = asset.Filename;

                ReferenceHyperLink.Text        = asset.AssetId.ToString();
                ReferenceHyperLink.NavigateUrl = SiteUtils.GetShowAssetInfoUrl(asset.AssetId.GetValueOrDefault());
                TitleHyperLink.Text            = asset.Title;
                TitleHyperLink.NavigateUrl     = ReferenceHyperLink.NavigateUrl;
                ProductionDateLabel.Text       = asset.GetProductionDate();
                FileSizeLabel.Text             = FileUtils.FriendlyFileSize(asset.FileSize);
                AssetTypeLabel.Text            = asset.AssetType.Name;

                string caption = SiteUtils.MakeJsSafe(SiteUtils.GetAssetHoverCaption(asset, string.Empty));
                string text    = SiteUtils.MakeJsSafe(SiteUtils.GetAssetHoverText(asset, string.Empty));

                TitleHyperLink.Attributes["OnMouseOver"] = string.Format("showToolTip('{0}', '{1}')", caption, text);
                TitleHyperLink.Attributes["OnMouseOut"]  = "hideToolTip()";

                if (StringUtils.IsBlank(TitleHyperLink.Text))
                {
                    TitleHyperLink.Text      = "not available";
                    TitleHyperLink.CssClass += " Italics";
                }

                break;
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (CurrentAsset.IsNull)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "close", "self.close();", true);
                    return;
                }

                // Get the asset ID
                int assetId = CurrentAsset.AssetId.GetValueOrDefault();

                // Get the asset type info
                AssetTypeInfo assetType = AssetTypeInfo.Get(CurrentAsset.FileExtension);


                //-----------------------------------------------------------------------------------------------------
                // Set up UI elements based on asset type
                //-----------------------------------------------------------------------------------------------------
                OrientationRow.Visible = assetType.HasOrientation;
                DurationRow.Visible    = assetType.HasDuration;
                DimensionsRow.Visible  = assetType.HasDimensions;

                //-----------------------------------------------------------------------------------------------------
                // Set up asset breadcrumbs based on category
                //-----------------------------------------------------------------------------------------------------
                AssetBreadcrumb.CategoryId = CurrentAsset.PrimaryCategoryId;

                //-----------------------------------------------------------------------------------------------------
                // Update the audit log
                //-----------------------------------------------------------------------------------------------------
                AuditLogManager.LogAssetAction(assetId, CurrentUser, AuditAssetAction.ViewedAssetDetail);
                AuditLogManager.LogUserAction(CurrentUser, AuditUserAction.ViewedAssetDetail, string.Format("Viewed asset detail for AssetId: {0}", assetId));

                //-----------------------------------------------------------------------------------------------------
                // Initialise the asset preview and buttons
                //-----------------------------------------------------------------------------------------------------
                AssetPreview1.Asset = CurrentAsset;
                AssetButtons1.Initialise(CurrentAsset);

                //-----------------------------------------------------------------------------------------------------
                // Bind categories list
                //-----------------------------------------------------------------------------------------------------
                AssetCategoriesContainer.Visible = (CurrentAsset.CategoryList.Count > 0);
                CategoriesRepeater.DataSource    = CurrentAsset.CategoryList;
                CategoriesRepeater.DataBind();

                //-----------------------------------------------------------------------------------------------------
                // Bind attached files
                //-----------------------------------------------------------------------------------------------------
                List <AssetFile> attachedFiles = CurrentAsset.GetAttachedFiles();
                AttachedFilesRow.Visible         = (attachedFiles.Count > 0);
                AttachedFilesDataList.DataSource = attachedFiles;
                AttachedFilesDataList.DataBind();

                //-----------------------------------------------------------------------------------------------------
                // Bind linked assets
                //-----------------------------------------------------------------------------------------------------
                LinkedAssetsRow.Visible         = (CurrentAsset.ReciprocalLinkedAssetList.Count > 0);
                LinkedAssetsRepeater.DataSource = CurrentAsset.ReciprocalLinkedAssetList;
                LinkedAssetsRepeater.DataBind();

                //-----------------------------------------------------------------------------------------------------
                // Set up the file type icon
                //-----------------------------------------------------------------------------------------------------
                FileTypeIconImage.ImageUrl = SiteUtils.GetFileTypeImageUrl(CurrentAsset.FileExtension);
                FileTypeIconImage.ToolTip  = CurrentAsset.Filename;

                //-----------------------------------------------------------------------------------------------------
                // Brand controlled metadata
                //-----------------------------------------------------------------------------------------------------
                AssetIdCell.InnerText      = CurrentAsset.AssetId.ToString();
                DateUploadedLabel.Text     = CurrentAsset.UploadDate.ToString(Global.DateFormat);
                FilenameCell.InnerText     = FileUtils.GetTruncatedFilename(CurrentAsset.Filename, 25);
                FileHashLabel.Text         = StringUtils.IsBlank(CurrentAsset.FileHash) ? "[Not Available]" : CurrentAsset.FileHash.Substring(0, 15) + " ...";
                FileHashLabel.ToolTip      = CurrentAsset.FileHash;
                FilesizeCell.InnerText     = FileUtils.FriendlyFileSize(CurrentAsset.FileSize);
                AssetTypeCell.InnerText    = CurrentAsset.AssetType.Name;
                DateProducedCell.InnerText = CurrentAsset.GetProductionDate();
                OriginatorCell.InnerText   = CurrentAsset.Originator;
                TitleCell.InnerText        = CurrentAsset.Title;
                ProjectCodeCell.InnerText  = CurrentAsset.ProjectCode;
                BrandCell.InnerText        = CurrentAsset.Brand.Name;

                AssetDescriptionContainer.InnerHtml = SiteUtils.ConvertTextToHtml(CurrentAsset.Description);
                AdditionalKeywordsCell.InnerText    = CurrentAsset.Keywords;
                CopyrightOwnerCell.InnerHtml        = StringUtils.IgnoreCaseCompare(CurrentAsset.CopyrightOwner, WebsiteBrandManager.GetBrand().OrganisationName) ? "(c) " + CurrentAsset.CopyrightOwner : CurrentAsset.CopyrightOwner;
                UsageRestrictionsCell.InnerHtml     = CurrentAsset.UsageRestrictions;
                ContactEmailHyperLink.EmailAddress  = CurrentAsset.ContactEmail;
                PublicationDateCell.InnerText       = CurrentAsset.PublishDate.ToString(Global.DateFormat);
                ExpiryDateCell.InnerText            = CurrentAsset.ExpiryDate.ToString(Global.DateFormat);

                // order metas according to their meta settings asset detail order numbers
                TrBrand.Attributes["class"]              = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.BRAND).AssetDetailOrderNum.ToString();
                TrAssetType.Attributes["class"]          = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.ASSET_TYPE).AssetDetailOrderNum.ToString();
                TrFilename.Attributes["class"]           = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.FILENAME).AssetDetailOrderNum.ToString();
                TrFileSize.Attributes["class"]           = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.FILESIZE).AssetDetailOrderNum.ToString();
                TrFileHash.Attributes["class"]           = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.FILEHASH).AssetDetailOrderNum.ToString();
                TrDateUploaded.Attributes["class"]       = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.DATE_UPLOADED).AssetDetailOrderNum.ToString();
                TrTitle.Attributes["class"]              = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.TITLE).AssetDetailOrderNum.ToString();
                TrProjectCode.Attributes["class"]        = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.PROJECT_CODE).AssetDetailOrderNum.ToString();
                TrOriginator.Attributes["class"]         = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.ORIGINATOR).AssetDetailOrderNum.ToString();
                TrDateProduced.Attributes["class"]       = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.DATE_PRODUCED).AssetDetailOrderNum.ToString();
                TrContactEmail.Attributes["class"]       = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.CONTACT_EMAIL).AssetDetailOrderNum.ToString();
                TrCopyrightOwner.Attributes["class"]     = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.COPYRIGHT_OWNER).AssetDetailOrderNum.ToString();
                TrRestrictedDownload.Attributes["class"] = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.DOWNLOAD_RESTRICTIONS).AssetDetailOrderNum.ToString();
                TrUsageRestrictions.Attributes["class"]  = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.USAGE_RESTRICTIONS).AssetDetailOrderNum.ToString();
                TrAdditionalKeywords.Attributes["class"] = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.ADDITIONAL_KEYWORDS).AssetDetailOrderNum.ToString();
                TrPublicationDate.Attributes["class"]    = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.PUBLICATION_DATE).AssetDetailOrderNum.ToString();
                TrExpiryDate.Attributes["class"]         = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.EXPIRY_DATE).AssetDetailOrderNum.ToString();
                LinkedAssetsRow.Attributes["class"]      = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.LINKED_ASSETS).AssetDetailOrderNum.ToString();
                AttachedFilesRow.Attributes["class"]     = CurrentAsset.Brand.GetMetadataSetting(BrandMetadataSettings.ATTACHED_FILES).AssetDetailOrderNum.ToString();

                var allSettings = BrandMetadataSettingManager.GetCustomMetadataSettings(CurrentAsset.Brand.BrandId.GetValueOrDefault());
                var lastNum     = allSettings.OrderBy(s => s.AssetDetailOrderNum).LastOrDefault().AssetDetailOrderNum;

                DimensionsRow.Attributes["class"]  = (lastNum++).ToString();
                DurationRow.Attributes["class"]    = (lastNum++).ToString();
                OrientationRow.Attributes["class"] = (lastNum++).ToString();

                //-----------------------------------------------------------------------------------------------------
                // Other stuff
                //-----------------------------------------------------------------------------------------------------
                OrientationCell.InnerText        = CurrentAsset.GetOrientation();
                DurationCell.InnerText           = SiteUtils.FriendlyDuration(CurrentAsset.Duration.GetValueOrDefault(), "Unknown");
                DimensionsCell.InnerText         = CurrentAsset.GetDimensions();
                RestrictedDownloadCell.InnerText = EntitySecurityManager.IsAssetRestricted(CurrentUser, CurrentAsset) ? "Yes" : "No";

                // Only show file metadata link if we have some available
                // ShowFileMeta data returns true if there is File metadata to display.
                FileMetadataLinkButton.Visible  = ShowFileMetadata();
                FileMetadataLinkDivider.Visible = FileMetadataLinkButton.Visible;

                //-----------------------------------------------------------------------------------------------------
                // Setup security in UI: Only display the edit and status links of the user has access
                //-----------------------------------------------------------------------------------------------------
                if (EntitySecurityManager.CanManageAsset(CurrentUser, CurrentAsset))
                {
                    string editUrl = "~/Admin/Assets/AssetForm.aspx?assetId=" + CurrentAsset.AssetId;
                    EditHyperLink.NavigateUrl = editUrl;
                    EditHyperLink.Attributes.Add("onClick", string.Format("GetParentWindow().location.href='{0}';self.close();return false;", ResolveUrl(editUrl)));

                    string statsUrl = "~/Admin/Reports/AssetStats.aspx?assetId=" + assetId;
                    StatsHyperLink.NavigateUrl = statsUrl;
                    StatsHyperLink.Attributes.Add("onClick", string.Format("GetParentWindow().location.href='{0}';self.close();return false;", ResolveUrl(statsUrl)));

                    string logHyperlink = "~/Admin/Reports/AssetAuditTrail.aspx?AssetId=" + CurrentAsset.AssetId;
                    LogHyperLink.NavigateUrl = logHyperlink;
                    LogHyperLink.Attributes.Add("onClick", string.Format("GetParentWindow().location.href='{0}';self.close();return false;", ResolveUrl(logHyperlink)));
                }
                else
                {
                    AssetLinksContainer.Visible = false;
                }

                //-----------------------------------------------------------------------------------------------------
                // Control access or AssetOrderHistory links.
                //-----------------------------------------------------------------------------------------------------
                if (!EntitySecurityManager.CanViewAssetOrderHistory(CurrentUser, CurrentAsset))
                {
                    // Get the asset order history, if there isn't any order history
                    // then hide the link.
                    // Set visiblity of order history link
                    OrderHistoryDivider.Visible    = false;
                    OrderHistoryLinkButton.Visible = false;
                }
                else
                {
                    // Get the asset order history, if there isn't any order history
                    // then hide the link.
                    if (!ShowOrderHistory())
                    {
                        // Set visiblity of order history link
                        OrderHistoryDivider.Visible    = false;
                        OrderHistoryLinkButton.Visible = false;
                    }
                }

                //-----------------------------------------------------------------------------------------------------
                // Populate blank cells
                //-----------------------------------------------------------------------------------------------------
                SiteUtils.PopulateBlankControl(AssetDescriptionContainer);
                SiteUtils.PopulateBlankControl(FilenameCell);
                SiteUtils.PopulateBlankControl(FilesizeCell);
                SiteUtils.PopulateBlankControl(TitleCell);
                SiteUtils.PopulateBlankControl(DurationCell);
                SiteUtils.PopulateBlankControl(ProjectCodeCell);
                SiteUtils.PopulateBlankControl(OriginatorCell);
                SiteUtils.PopulateBlankControl(DateProducedCell);
                SiteUtils.PopulateBlankControl(CopyrightOwnerCell);
                SiteUtils.PopulateBlankControl(OrientationCell);
                SiteUtils.PopulateBlankControl(UsageRestrictionsCell);
            }

            //sort metas on every request
            ClientScript.RegisterStartupScript(GetType(), "SortMetas2", "SortMetas();", true);

            //bind repeater on every request as otherwise labels stuff is lost
            MetadataRepeater.DataSource = BrandMetadataSettingManager.GetCustomMetadataSettings(CurrentAsset.BrandId);
            MetadataRepeater.DataBind();
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int assetTypeId = WebUtils.GetIntRequestParam("AssetTypeId", 0);
                AssetTypeDropDownList.SafeSelectValue(assetTypeId);

                int    id  = WebUtils.GetIntRequestParam("AssetTypeFileExtensionId", 0);
                string ext = WebUtils.GetRequestParam("Extension", string.Empty);

                AssetTypeFileExtension atfe = AssetTypeFileExtensionCache.Instance.GetById(id);

                if (atfe.IsNull && !StringUtils.IsBlank(ext))
                {
                    atfe = AssetTypeFileExtensionCache.Instance.GetByExtension(ext);
                }

                if (!atfe.IsNull)
                {
                    AssetTypeFileExtensionId = atfe.AssetTypeFileExtensionId.GetValueOrDefault();

                    // Populate UI
                    ExtensionTextBox.Text    = atfe.Extension;
                    FileTypeNameTextBox.Text = atfe.Name;
                    IconImage.ImageUrl       = SiteUtils.GetFileTypeImageUrl(atfe.Extension);
                    AssetTypeDropDownList.SafeSelectValue(atfe.AssetTypeId);
                    IsVisibleCheckBox.Checked = atfe.IsVisible;
                    IconImagePanel.Visible    = true;
                    DeleteButton.Visible      = true;


                    string generatedExtension = APSGateway.Instance.GeneratesFileExtension(atfe.Extension);
                    PreviewPluginDropDownList.Extension         = generatedExtension;
                    PreviewFileFormatLabel.Text                 = generatedExtension;
                    PreviewPluginDropDownList.ShowSupportedOnly = ShowSupportedPluginsCheckbox.Checked;
                    PreviewPluginDropDownList.RefreshFromDataSource();

                    if (atfe.Plugin != Guid.Empty)
                    {
                        //try and select the file extensions plugin
                        PreviewPluginDropDownList.SafeSelectValue(PluginManager.GetPluginId(atfe.Plugin));

                        if (PreviewPluginDropDownList.SelectedValue == PreviewPluginDropDownList.BlankValue)
                        {
                            //not found in supported list so try finding the plugin in the unsupported list
                            ShowSupportedPluginsCheckbox.Checked        = false;
                            PreviewPluginDropDownList.ShowSupportedOnly = false;
                            PreviewPluginDropDownList.RefreshFromDataSource();
                            PreviewPluginDropDownList.SafeSelectValue(PluginManager.GetPluginId(atfe.Plugin));
                        }
                    }

                    ProcessingSupportPlaceHolder.Visible = true;
                    ProcessingSupportLabel.Text          = (APSGateway.Instance.CanProcess(atfe.Extension) ? "Yes" : "No");

                    // Duplicate, clear extension
                    if (WebUtils.GetRequestParam("Action", string.Empty) == "Duplicate")
                    {
                        ExtensionTextBox.Text = string.Empty;
                    }
                }
            }
        }