예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Ensure we have asset id
            m_AssetId = GetRequiredQueryStringParameter("AssetId", "~/Admin/Assets/AssetList.aspx");

            // Setup return link
            SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?AssetId={0}", m_AssetId), ReturnToAssetHyperLink1);
            SiteUtils.SetHyperLink("Assets.AssetForm", string.Format("?AssetId={0}", m_AssetId), ReturnToAssetHyperLink2);

            if (!Page.IsPostBack)
            {
                //Setup preview settings option
                AssetFileLabel.Text = Asset.Title + " (" + Asset.FileExtension + ")";

                ProcessingStatusFalseRadioButton.Checked = (!Asset.IsProcessed);
                ProcessingStatusTrueRadioButton.Checked  = Asset.IsProcessed;

                //set the default plugin
                PreviewPluginDropDownList.RefreshFromDataSource();

                //check if asset uses non-default plugin
                bool usingCustomPlugin = false;
                if (Asset.Plugin != Guid.Empty)
                {
                    Plugin customPlugin = ContextInfo.PluginManager.GetPluginForAsset(Asset);
                    if (customPlugin.RegistrationKey == Asset.Plugin)
                    {
                        PreviewPluginDropDownList.SelectItem(customPlugin.PluginId.GetValueOrDefault(), 0);
                        usingCustomPlugin = true;
                    }
                }

                //sets the selected plugin to the default
                if (!usingCustomPlugin)
                {
                    PreviewPluginDropDownList.SelectItem(0, -1);
                }

                // Initialise the asset thumbnail and preview
                AssetThumbnail1.Initialise(Asset);
                AssetPreview1.Asset = Asset;
            }

            ConfigurePreviewSettings();
        }
예제 #2
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;
                    }
                }
            }
        }
예제 #3
0
 protected void ShowSupportedPluginsCheckbox_CheckChanged(object sender, EventArgs e)
 {
     PreviewPluginDropDownList.ShowSupportedOnly = ShowSupportedPluginsCheckbox.Checked;
     PreviewPluginDropDownList.RefreshFromDataSource();
 }