Esempio n. 1
0
    /// <summary>
    /// Loads the form control data.
    /// </summary>
    private void InitializeControl()
    {
        if (FormObject != null)
        {
            // Icon CSS class
            txtCssClass.Text    = FormObject.GetStringValue(IconCssFieldName, null);
            txtCssClass.ToolTip = GetString("fontIconCss.tooltip");

            // Load file uploader
            fileUploader.Category   = Category;
            fileUploader.ObjectType = FormObject.TypeInfo.ObjectType;
            fileUploader.ObjectID   = FormObject.Generalized.ObjectID;

            if (FormObject.Generalized.ObjectSiteID > 0)
            {
                fileUploader.SiteID = FormObject.Generalized.ObjectSiteID;
            }

            // Identify the currently selected icon type
            iconType = IconTypeEnum.Metafile;
            if (!string.IsNullOrEmpty(txtCssClass.Text))
            {
                iconType = IconTypeEnum.CssClass;
            }

            lstOptions.SelectedValue = iconType.ToStringRepresentation();
        }

        InitializeUploadControl();
    }
    /// <summary>
    /// Loads the form control data.
    /// </summary>
    private void InitializeControl()
    {
        if (DocumentType == null)
        {
            return;
        }

        // First load initialization
        if (!RequestHelper.IsPostBack())
        {
            // Icon CSS class
            txtCssClass.ToolTip = GetString("fontIconCss.tooltip");

            // Identify the currently selected icon type
            iconType = IconTypeEnum.Files;
            if (!string.IsNullOrEmpty(txtCssClass.Text))
            {
                iconType = IconTypeEnum.CssClass;
            }

            lstOptions.SelectedValue = iconType.ToStringRepresentation();
        }

        // This control can be used only under existing document type
        if (SystemContext.DevelopmentMode)
        {
            // Allow 'gif' images in development mode
            dfuSmall.AllowedExtensions = "gif;png";
            dfuLarge.AllowedExtensions = "gif;png";
        }

        // Hide direct file uploader for external storage
        if (StorageHelper.IsExternalStorage("~/App_Themes/Default/Images/DocumentTypeIcons"))
        {
            dfuLarge.Visible = false;
            dfuSmall.Visible = false;
        }

        // Register refresh script
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshIcons", ScriptHelper.GetScript("function RefreshIcons() {" + ControlsHelper.GetPostBackEventReference(this, "update") + "}"));
    }