Esempio n. 1
0
    /// <summary>
    /// Initializes all the nested controls and control itself.
    /// </summary>
    private void SetupControl()
    {
        // Register modal dialog handling script
        ScriptHelper.RegisterDialogScript(Page);

        // Setup buttons
        btnAdd.ToolTip    = GetString("dialogs.actions.newfolder.desc");
        btnCopy.ToolTip   = GetString("media.tree.copyfolder");
        btnMove.ToolTip   = GetString("media.tree.movefolder");
        btnDelete.ToolTip = GetString("media.folder.delete");

        // If delete script is set
        if (!string.IsNullOrEmpty(DeleteScript))
        {
            // Register delete script
            btnDelete.OnClientClick = DeleteScript.Replace("##FOLDERPATH##", Path.EnsureSlashes(FolderPath).Replace("'", "\\'")) + "return false;";
        }

        // If folder path is set
        if (String.IsNullOrEmpty(FolderPath))
        {
            // Disable delete action
            btnDelete.Enabled = false;

            // Disable move action
            btnMove.Enabled = false;
        }

        if (!FileSystemActionsEnabled)
        {
            // Disable file and folder actions
            btnAdd.Enabled = false;
        }

        if (!IsLiveSite)
        {
            Config = DialogConfiguration.GetDialogConfiguration();
            if (Config != null)
            {
                switch (Config.CustomFormatCode.ToLowerCSafe())
                {
                case "link":
                    btnAdd.Visible = false;
                    break;

                case "linkdoc":
                    btnAdd.Visible = false;
                    break;

                case "relationship":
                    btnAdd.Visible = false;
                    break;

                case "selectpath":
                    btnAdd.Visible = false;
                    break;
                }
            }
        }

        string disableMenuItem = @"
function DisableNewFolderBtn() { 
    $cmsj('#' + '" + btnAdd.ClientID + @"').attr('disabled', 'disabled');
}";

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableMenuItem", ScriptHelper.GetScript(disableMenuItem));
    }
Esempio n. 2
0
    /// <summary>
    /// Initializes all the nested controls.
    /// </summary>
    private void SetupControls()
    {
        // Register modal dialog script
        ScriptHelper.RegisterDialogScript(Page);

        string disableMenuItem =
            @"function DisableNewFileBtn() {                                      
    $j('#dialogsUploaderDiv').attr('style', 'display:none;');                                 
    $j('#dialogsUploaderDisabledDiv').removeAttr('style');
}

function DisableNewFolderBtn() { " + menuBtnNewFolder.DisableButtonFunction + " }";

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableMenuItem", ScriptHelper.GetScript(disableMenuItem));

        if (!FileSystemActionsEnabled)
        {
            // Disable file and folder actions
            menuBtnNewFolder.Enabled = false;
            ScriptHelper.RegisterStartupScript(Page, typeof(string), "disableNewFile", ScriptHelper.GetScript("DisableNewFileBtn();"));
        }

        if (!IsLiveSite)
        {
            // Initialize help
            switch (SourceType)
            {
            case MediaSourceEnum.DocumentAttachments:
                helpElem.TopicName = "dialogs_{0}attachments";
                break;

            case MediaSourceEnum.MediaLibraries:
                helpElem.TopicName = "dialogs_{0}media";
                break;

            case MediaSourceEnum.Web:
                helpElem.TopicName = "dialogs_{0}web";
                break;

            case MediaSourceEnum.MetaFile:
                helpElem.TopicName = "dialogs_{0}metafiles";
                break;

            default:
                helpElem.TopicName = "dialogs_{0}content";
                break;
            }

            Config = DialogConfiguration.GetDialogConfiguration();
            if ((Config != null) && (Config.OutputFormat == OutputFormatEnum.BBLink) || (Config.OutputFormat == OutputFormatEnum.HTMLLink))
            {
                helpElem.TopicName = string.Format(helpElem.TopicName, "link_");
            }
            else
            {
                helpElem.TopicName = helpElem.TopicName.Replace("{0}", "");
            }

            switch (Config.CustomFormatCode.ToLowerCSafe())
            {
            case "copy":
                helpElem.TopicName = "document_copy";
                break;

            case "move":
                helpElem.TopicName = "document_move";
                break;

            case "link":
                helpElem.TopicName       = "document_link";
                menuBtnNewFolder.Visible = false;
                break;

            case "linkdoc":
                helpElem.TopicName       = "document_linkdoc";
                menuBtnNewFolder.Visible = false;
                break;

            case "relationship":
                helpElem.TopicName       = "select_node_for_relationship";
                menuBtnNewFolder.Visible = false;
                break;

            case "selectpath":
                helpElem.TopicName       = "select_path";
                menuBtnNewFolder.Visible = false;
                break;
            }

            // Media library mode
            if (DisplayMode == ControlDisplayModeEnum.Simple)
            {
                helpElem.StopProcessing = true;
                pnlHelp.Visible         = false;
            }
        }
        else
        {
            helpElem.StopProcessing = true;
            pnlHelp.Visible         = false;
        }

        // Register resizer script for fullscreen mode
        if (AllowFullscreen)
        {
            ScriptHelper.RegisterResizer(Page);
        }
    }