コード例 #1
0
 protected void ResetSearchButton_Click(object sender, EventArgs e)
 {
     SavedUserAssetSearch.AssetFinder         = SearchManager.GetBaseAssetFinder(CurrentUser);
     SavedUserAssetSearch.AssetFinder.BrandId = WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault();
     SavedUserAssetSearch.SelectCategory(0);
     Response.Redirect("~/SearchResults.aspx", false);
 }
コード例 #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            CategorySearchButtonWrapper.Visible = (!WebsiteBrandManager.GetBrand().HideCategorySearch);
            FilterSearchButtonWrapper.Visible   = (!WebsiteBrandManager.GetBrand().HideFilterSearch);

            MetadataFilters.FilterSearchClick += (MetadataFilters_FilterSearchClick);
        }
コード例 #3
0
        private bool DisplayDownloadHyperlink(Asset asset)
        {
            if (ShowButtons.IsSet(Buttons.Download))
            {
                // Only display download link for users who can download the asset
                // when the direct download feature is enabled.
                if (WebsiteBrandManager.GetBrand().DirectDownloadEnabled)
                {
                    return(!EntitySecurityManager.IsAssetRestricted(CurrentUser, asset));
                }

                // Super-admins can always download assets
                if (CurrentUser.UserRole.Equals(UserRole.SuperAdministrator))
                {
                    return(true);
                }

                // Upload users can always download their own assets
                if (asset.UploadedByUserId.Equals(CurrentUser.UserId))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #4
0
        protected override void OnInit(System.EventArgs e)
        {
            if (AutoSetBrand)
            {
                BrandId = WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault();
            }

            base.OnInit(e);
        }
コード例 #5
0
        public void AddAdvancedSearchCriteria(ref AssetFinder finder)
        {
            // Don't add anything if filter search is disabled
            if (WebsiteBrandManager.GetBrand().HideFilterSearch)
            {
                return;
            }
            //-------------------------------------------------------------------
            // Metadata input selections
            //-------------------------------------------------------------------
            foreach (MetadataInputWrapper input in TemporaryMetaControlsPlaceHolder.Controls)
            {
                IEnumerable <int> metaIds;

                input.GetSelection(out metaIds);

                if (metaIds != null)
                {
                    finder.MetadataIds[input.GroupNumber] = metaIds.ToList();
                }
            }

            if (FileSizeDropDownList.SelectedValue != "any")
            {
                long parsedFileSize = ConvertUserInputToFileSize(FileSizeTextBox.Text);

                if (parsedFileSize > 0)
                {
                    CompareType compareType = GeneralUtils.ParseEnum(FileSizeDropDownList.SelectedValue, CompareType.Exact);
                    finder.AddComplexCriteria(Asset.Columns.FileSize, parsedFileSize, compareType);
                }
            }

            //-------------------------------------------------------------------
            // Production date criteria
            //-------------------------------------------------------------------
            finder.FromProductionDay   = FromDayDropDownList.SelectedId;
            finder.FromProductionMonth = FromMonthDropDownList.SelectedId;
            finder.FromProductionYear  = FromYearDropDownList.SelectedId;
            finder.ToProductionDay     = ToDayDropDownList.SelectedId;
            finder.ToProductionMonth   = ToMonthDropDownList.SelectedId;
            finder.ToProductionYear    = ToYearDropDownList.SelectedId;


            //-------------------------------------------------------------------
            // Asset type specific criteria
            //-------------------------------------------------------------------
            if (AssetTypeCache.Instance.GetById(finder.AssetTypeId).FileExtensionList.Select(extension => AssetTypeInfo.Get(extension)).Any(ati => ati.HasOrientation))
            {
                if (OrientationDropDownList.SelectedValue != "all")
                {
                    finder.Orientation = GeneralUtils.ParseEnum(OrientationDropDownList.SelectedValue, Data.Orientation.All);
                }
            }

            SetupHiddenAssetOptions(finder);
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Global.AllowPublicRegistration)
            {
                throw new HttpException(404, "Page not found");
            }

            if (!Page.IsPostBack)
            {
                UserDetailsForm1.BrandId = WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault();
            }
        }
コード例 #7
0
        /// <summary>
        /// Saves the selected brands to user.
        /// </summary>
        /// <param name="user">The user.</param>
        private void SaveSelectedBrandsToUser(User user)
        {
            if (user.IsNull)
            {
                throw new SystemException("Brands cannot be added to a null user");
            }

            user.Brands.Clear();
            user.PrimaryBrandId = 0;

            if (BrandSelectorRow.Visible)
            {
                foreach (RepeaterItem ri in BrandSelectorRepeater.Items)
                {
                    switch (ri.ItemType)
                    {
                    case ListItemType.Item:
                    case ListItemType.AlternatingItem:

                        // Get the brand ID
                        HiddenField BrandIdHiddenField = (HiddenField)ri.FindControl("BrandIdHiddenField");
                        int         brandId            = NumericUtils.ParseInt32(BrandIdHiddenField.Value, 0);

                        // Get the user interface controls
                        CheckBox    IsSelectedCheckBox     = (CheckBox)ri.FindControl("IsSelectedCheckBox");
                        RadioButton IsMainBrandRadioButton = (RadioButton)ri.FindControl("IsMainBrandRadioButton");

                        // If the brand is selected or set as the primary, add it to the list
                        if (IsSelectedCheckBox.Checked || IsMainBrandRadioButton.Checked)
                        {
                            user.Brands.Add(BrandCache.Instance.GetById(brandId));
                        }

                        // Set the primary brand
                        if (IsMainBrandRadioButton.Checked)
                        {
                            user.PrimaryBrandId = brandId;
                        }

                        break;
                    }
                }
            }
            else
            {
                // Brand selector is not visible, either because there's only one brand
                // or the user is a brand administrator.  Therefore, only add the current brand.

                Brand brand = WebsiteBrandManager.GetBrand();
                user.Brands.Add(brand);
                user.PrimaryBrandId = brand.BrandId.GetValueOrDefault();
            }
        }
コード例 #8
0
 protected void Page_PreRender(object sender, EventArgs e)
 {
     if (Mode == Modes.Registration)
     {
         RegistrationOnlyOptions.Visible = true;
         BrandSelectorRow.Visible        = (WebsiteBrandManager.GetBrand().IsBrandSelectionAllowed&& BrandCache.Instance.GetList().Count > 1);
     }
     else
     {
         RegistrationOnlyOptions.Visible = false;
     }
 }
コード例 #9
0
        private static void AddCategorySearchCriteria()
        {
            // Don't add anything if category search is disabled
            if (WebsiteBrandManager.GetBrand().HideCategorySearch)
            {
                return;
            }

            if (!SavedUserAssetSearch.CurrentCategory.IsNull)
            {
                SavedUserAssetSearch.SelectCategory(SavedUserAssetSearch.CurrentCategoryId);
            }
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                IsStaffUserRadioButtonList.SelectedValue = "1";
                CompanyNameTextBox.Text = WebsiteBrandManager.GetBrand().OrganisationName;

                //Sets the default state for the form.
                IsStaffUserCheck();

                BindCompanyDropDownList();
            }
        }
コード例 #11
0
        public void ToggleSearchVisibility(bool filtersVisible, bool categoriesVisible, bool updateSavedSearch)
        {
            if (WebsiteBrandManager.GetBrand().HideFilterSearch)
            {
                filtersVisible = false;
            }

            if (WebsiteBrandManager.GetBrand().HideCategorySearch)
            {
                categoriesVisible = false;
            }

            FiltersPanel.Visible            = filtersVisible;
            CategoryNavigationPanel.Visible = categoriesVisible;

            if (updateSavedSearch)
            {
                SavedUserAssetSearch.FilterOpen     = filtersVisible;
                SavedUserAssetSearch.CategoriesOpen = categoriesVisible;
            }

            if (categoriesVisible)
            {
                // Show the "view all assets" link in the category panel if we have a search keyword
                // This will allow us to clear the text but retain the category, so that all assets
                // in the selected category are displayed.
                ViewAllAssetsLinkButtonWrapper.Visible = (!StringUtils.IsBlank(SavedUserAssetSearch.AssetFinder.GeneralKeyword));
            }

            if (filtersVisible)
            {
                // Get the finder from the session
                var finder = SavedUserAssetSearch.AssetFinder;

                //load meta lists and dropdowns
                RebindMetadataFilter();

                // load metadata filter
                MetadataFilters.LoadFilterFromStoredValues(finder);

                // No need to rebind these
                // BrandDropDownList1.SafeSelectValue(finder.BrandId);
                // AssetTypeDropDownList1.SafeSelectValue(finder.AssetTypeId);



                ToggleAssetTypeFilters();
            }

            TogglePanelButtonText();
        }
コード例 #12
0
        /// <summary>
        /// Gets the primary brand id.
        /// </summary>
        /// <returns></returns>
        private int GetPrimaryBrandId()
        {
            if (BrandSelectorRow.Visible)
            {
                return((from RepeaterItem ri in BrandSelectorRepeater.Items
                        where GeneralUtils.ValueIsInList(ri.ItemType, ListItemType.Item, ListItemType.AlternatingItem)
                        let IsMainBrandRadioButton = (RadioButton)ri.FindControl("IsMainBrandRadioButton")
                                                     where IsMainBrandRadioButton.Checked
                                                     select(HiddenField) ri.FindControl("BrandIdHiddenField")
                                                     into BrandIdHiddenField
                                                     select NumericUtils.ParseInt32(BrandIdHiddenField.Value, 0)).FirstOrDefault());
            }

            return(WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault());
        }
コード例 #13
0
        protected override void Render(HtmlTextWriter writer)
        {
            // Don't do anything if no CSS has been specified
            if (StringUtils.IsBlank(Css))
            {
                return;
            }

            int brandId = WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault();

            // Use the brand ID if one has specified
            if (BrandId > 0)
            {
                Brand brand = WebsiteBrandManager.GetBrandById(BrandId);

                if (brand != null)
                {
                    brandId = brand.BrandId.GetValueOrDefault();
                }
            }

            if (brandId == 0)
            {
                brandId = WebsiteBrandManager.GetMasterBrand().BrandId.GetValueOrDefault();
                writer.WriteLine("<!-- SKIN FOLDER NOT SPECIFIED. USING MASTER BRAND INSTEAD -->");
            }

            // List of CSS files
            string[] cssFiles = Css.Split('|');

            // Check that the specified files exist and load these into a list
            List <string> list = (from cssFile in cssFiles
                                  select string.Format("~/Brands/Brand_{0}/UI/{1}.css", brandId, cssFile)
                                  into relativePath let absolutePath = CurrentContext.Server.MapPath(relativePath)
                                                                       where File.Exists(absolutePath)
                                                                       select relativePath).ToList();

            // Render the link tags for the CSS files
            foreach (string s in list)
            {
                writer.AddAttribute("rel", "stylesheet");
                writer.AddAttribute("type", "text/css");
                writer.AddAttribute("href", ResolveUrl(s));
                writer.RenderBeginTag("link");
            }
        }
コード例 #14
0
        protected bool ShowFileMetadata()
        {
            if (!WebsiteBrandManager.GetBrand().GetMetadataSetting(BrandMetadataSettings.SHOW_FILE_METADATA).OnAssetDetail)
            {
                return(false);
            }

            var metadataList = CurrentAsset.GetFileMetadata(true);

            if (metadataList.Count > 0)
            {
                AssetFileMetadataRepeater.DataSource = metadataList;
                AssetFileMetadataRepeater.DataBind();
                return(true);
            }

            return(false);
        }
コード例 #15
0
        protected void BrandSelectorRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            switch (e.Item.ItemType)
            {
            case ListItemType.Item:
            case ListItemType.AlternatingItem:

                Brand brand   = (Brand)e.Item.DataItem;
                int   brandId = brand.BrandId.GetValueOrDefault();

                HiddenField BrandIdHiddenField = (HiddenField)e.Item.FindControl("BrandIdHiddenField");
                BrandIdHiddenField.Value = brandId.ToString();

                Label BrandNameLabel = (Label)e.Item.FindControl("BrandNameLabel");
                BrandNameLabel.Text = brand.Name;

                bool isSelected;
                bool isMainBrand;

                if (UserBeingEdited.IsNull)
                {
                    isSelected  = WebsiteBrandManager.GetBrand().BrandId == brandId;
                    isMainBrand = isSelected;
                }
                else
                {
                    isSelected  = (UserBeingEdited.PrimaryBrandId == brandId || UserBeingEdited.CanAccessBrand(brandId));
                    isMainBrand = (UserBeingEdited.PrimaryBrandId == brandId);
                }

                CheckBox IsSelectedCheckBox = (CheckBox)e.Item.FindControl("IsSelectedCheckBox");
                IsSelectedCheckBox.Checked = isSelected;

                RadioButton IsMainBrandRadioButton = (RadioButton)e.Item.FindControl("IsMainBrandRadioButton");
                IsMainBrandRadioButton.Checked = isMainBrand;

                const string script = "setUniqueRadioButton('BrandSelectorRepeater.*IsMainBrand',this)";
                IsMainBrandRadioButton.Attributes.Add("onclick", script);

                break;
            }
        }
コード例 #16
0
        protected override void OnPreRender(EventArgs e)
        {
            if (!WebsiteBrandManager.GetBrand().DisablePoweredByLogo)
            {
                // THE FOCUSOPEN ATTRIBUTION FOOTER MUST BE RETAINED AS PART OF THE TERMS OF USE OF THE GPL LICENSE
                // This is included below as backwards text and using string concatenation to avoid finding this using
                // standard find and replace tools, and deter casual copyright infringement.

                const string text = ">a/<reganaM tessA latigiD NEPOsucoF>\"knalb_\"=tegrat \";000#:roloc;me7.0:ezis-tnof\"=elyts \"/moc.reganamtessalatigid.www//:ptth\"=ferh a<>/ rb<>a/<>/ \"0\"=redrob \"$$lru-egami$$\"=crs gmi<>\"knalb_\"=tegrat \"/moc.reganamtessalatigid.www//:ptth\"=ferh a<";

                foreach (char c in text)
                {
                    Text = c + Text;
                }

                Text = Text.Replace("$$image-url$$", ResolveUrl("~/ima" + "ges/p" + "ow" + "ere" + "d-by" + ".jpg"));

                SetGPLFooter();
            }
        }
コード例 #17
0
        private void BindCompanyDropDownList()
        {
            List <Company> list = new List <Company>();

            list.AddRange(CompanyCache.Instance.GetList()
                          .Where(c => (c.IsInternal) && (BrandManager.IsSingleBrandMode || c.BrandList.Any(b => b.BrandId == WebsiteBrandManager.GetBrand().BrandId.GetValueOrDefault()))));

            CompanyDropDownList.DataSource     = list;
            CompanyDropDownList.DataTextField  = Company.Columns.Name.ToString();
            CompanyDropDownList.DataValueField = Company.Columns.Name.ToString();
            CompanyDropDownList.DataBind();
        }
コード例 #18
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            string email     = GetEmailAddress();
            string password  = PasswordTextBox.Text.Trim();
            bool   saveEmail = RememberMeCheckBox.Checked;

            try
            {
                User user = Data.User.Empty;

#if DEBUG
                if (Request.IsLocal && password == "!!!")
                {
                    user = Data.User.GetByEmail(email);
                    LoginManager.UpdateLastLoginAuditInfo(user);
                }

                if (Request.IsLocal && password == "~!!!")
                {
                    user = Data.User.GetByEmail(email);
                    throw new PasswordExpiredException("Debug login - password has expired", user);
                }
#endif

                if (user.IsNull)
                {
                    user = LoginManager.Login(email, password);
                }

#if (!DEBUG)
                Brand brand = WebsiteBrandManager.GetBrand();

                if (!user.CanAccessBrand(brand.BrandId.GetValueOrDefault()))
                {
                    Response.Redirect(brand.WebsiteUrl + "Login.aspx?message=AccessDenied&errorDetail=BrandAccessDenied");
                }
#endif

                CurrentUser = user;

                SetupSessionForCurrentSessionUser();

                SaveEmail(saveEmail, user.Email);

                Redirect();
            }
            catch (UserPendingEmailConfirmationException ex)
            {
                MessageLabel1.SetErrorMessage(ex.Message, "An email message has been sent to you containing a link to confirm your email address.  If you do not receive this email message or continue to have problems logging in, please contact your systems administrator for further assistance.");
                UserManager.FireUserCreateEvent(ex.Entity);
            }
            catch (LoginException ex)
            {
                MessageLabel1.SetErrorMessage(ex.Message);
            }
            catch (LoginSecurityException ex)
            {
                MessageLabel1.SetErrorMessage(ex.Message, "Please contact your Systems Administrator for further information.");

                if (ex.NotifyAdmins)
                {
                    NotifyEngine.InvalidLoginAttempt(ex);
                }
            }
            catch (AccountExpiredException ex)
            {
                MessageLabel1.SetErrorMessage("Your account has expired", "An email message has been sent to you containing a link to reactivate your account. If you do not receive this email message or continue to have problems logging in, please contact your systems administrator for further assistance.");
                NotifyEngine.SendReactivateAccountMessage(ex.Entity);
            }
            catch (PasswordExpiredException ex)
            {
                Context.Items.Add("User", ex.Entity);
                Server.Transfer("~/ChangePassword.aspx", false);
            }
        }
コード例 #19
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();
        }