예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool checkUI = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CKEditor:PersonalizeToolbarOnLiveSite"], false);

        if (checkUI)
        {
            // Check UIProfile
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
            {
                RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertImageOrMedia");
            }
            else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "WebTab"))
            {
                RedirectToUIElementAccessDenied("CMS.MediaDialog", "WebTab");
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            webContentSelector.StopProcessing = true;
            webContentSelector.Visible        = false;
            string url = ResolveUrl("~/CMSMessages/Error.aspx?title=" + GetString("dialogs.badhashtitle") + "&text=" + GetString("dialogs.badhashtext") + "&cancel=1");
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
    protected void hdnButton_Click(object sender, EventArgs e)
    {
        Hashtable properties = GetSelectedItem();
        string    script;

        if (Config.OutputFormat == OutputFormatEnum.URL)
        {
            properties[DialogParameters.URL_URL]          = txtUrl.Text.Trim();
            properties[DialogParameters.EDITOR_CLIENTID]  = Config.EditorClientID;
            properties[DialogParameters.IMG_ALT]          = txtAlt.Text.Trim();
            properties[DialogParameters.IMG_ALT_CLIENTID] = QueryHelper.GetString(DialogParameters.IMG_ALT_CLIENTID, String.Empty);
            script = CMSDialogHelper.GetUrlItem(properties);
        }
        else
        {
            switch (drpMediaType.SelectedValue)
            {
            case "image":
                script = CMSDialogHelper.GetImageItem(properties);
                break;

            case "av":
                script = CMSDialogHelper.GetAVItem(properties);
                break;

            default:
                script = CMSDialogHelper.GetUrlItem(properties);
                break;
            }
        }
        if (!String.IsNullOrEmpty(script))
        {
            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "insertItemScript", ScriptHelper.GetScript(script));
        }
    }
예제 #3
0
    /// <summary>
    /// Returns correct URL of the select path dialog.
    /// </summary>
    /// <param name="textboxId">Client ID of the textbox where result should be returned.</param>
    private string GetDocumentDialogUrl(string textboxId)
    {
        var config = new DialogConfiguration
        {
            HideLibraries       = true,
            HideAnchor          = true,
            HideAttachments     = true,
            HideContent         = false,
            HideEmail           = true,
            HideWeb             = true,
            EditorClientID      = textboxId,
            ContentSelectedSite = SiteContext.CurrentSiteName,
            OutputFormat        = OutputFormatEnum.Custom,
            CustomFormatCode    = "selectpath",
            SelectableContent   = SelectableContentEnum.AllContent,
            SelectablePageTypes = SelectablePageTypeEnum.Standard,
            ContentSites        = AvailableSitesEnum.OnlyCurrentSite
        };

        string url = CMSDialogHelper.GetDialogUrl(config, false, false, null, false);

        url = URLHelper.RemoveParameterFromUrl(url, "hash");
        url = URLHelper.AddParameterToUrl(url, "selectionmode", "single");
        url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));

        return(url);
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string           output       = QueryHelper.GetString("output", "");
        OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));

        // Check UIProfile
        if ((outputFormat == OutputFormatEnum.HTMLMedia) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
        {
            RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertImageOrMedia");
        }
        else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "WebTab"))
        {
            RedirectToUIElementAccessDenied("CMS.MediaDialog", "WebTab");
        }

        // CKEditor's plugin filebrowser add custom params to url.
        // This ensures that custom params aren't validated
        if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            webContentSelector.StopProcessing = true;
            webContentSelector.Visible        = false;
            string url = ResolveUrl(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool checkUI = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CKEditor:PersonalizeToolbarOnLiveSite"], false);

        if (checkUI)
        {
            // Check UIProfile
            if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink");
            }
            else if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AnchorTab"))
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.MediaDialog", "AnchorTab");
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(this.Page);
            CMSDialogHelper.RegisterDialogHelper(this.Page);
        }
        else
        {
            string url = ResolveUrl("~/CMSMessages/Error.aspx?title=" + GetString("dialogs.badhashtitle") + "&text=" + GetString("dialogs.badhashtext") + "&cancel=1");
            this.ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
예제 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Setup the filesystem browser
        if (!String.IsNullOrEmpty(Path))
        {
            // Register scripts
            ScriptHelper.RegisterJQuery(this.Page);
            CMSDialogHelper.RegisterDialogHelper(this.Page);
            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "InitResizers", "$j(InitResizers());", true);
            CSSHelper.RegisterCSSBlock(Page, ".TooltipImage{max-width:200px; max-height:200;}");

            string filePath = Server.MapPath(Path);
            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }

            // Setup the browser
            FileSystemDialogConfiguration config = new FileSystemDialogConfiguration();
            config.StartingPath      = Path;
            config.AllowedExtensions = "gif;png;bmp;jpg;jpeg;css;skin";
            config.ShowFolders       = false;
            config.AllowManage       = true;

            selFile.Config = config;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        bool checkUI = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CKEditor:PersonalizeToolbarOnLiveSite"], false);

        if (checkUI)
        {
            // Check UIProfile
            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink");
            }
            else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AnchorTab"))
            {
                RedirectToUIElementAccessDenied("CMS.MediaDialog", "AnchorTab");
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            anchorProperties.StopProcessing = true;
            anchorProperties.Visible        = false;
            string url = ResolveUrl(AdministrationUrlHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
    /// <summary>
    /// Returns argument set for the passed file data row.
    /// </summary>
    /// <param name="data">Data object holding all the data on the current file</param>
    public static string GetArgumentSet(IDataContainer data)
    {
        StringBuilder sb = new StringBuilder();

        if (data.ContainsColumn("FileGUID"))
        {
            sb.Append("FileName|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileName")));
            sb.Append("|FileGUID|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileGUID")));
            sb.Append("|FilePath|" + CMSDialogHelper.EscapeArgument(data.GetValue("FilePath")));
            sb.Append("|FileExtension|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileExtension")));
            sb.Append("|FileImageWidth|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileImageWidth")));
            sb.Append("|FileImageHeight|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileImageHeight")));
            sb.Append("|FileTitle|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileTitle")));
            sb.Append("|FileSize|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileSize")));
            sb.Append("|FileID|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileID")));
        }
        else
        {
            sb.Append("FileName|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileName")));
            sb.Append("|Extension|" + CMSDialogHelper.EscapeArgument(data.GetValue("Extension")));
            sb.Append("|FileURL|" + CMSDialogHelper.EscapeArgument(data.GetValue("FileURL")));
            sb.Append("|Size|" + CMSDialogHelper.EscapeArgument(data.GetValue("Size")));
        }

        return(sb.ToString());
    }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool checkUI = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CKEditor:PersonalizeToolbarOnLiveSite"], false);

        if (checkUI)
        {
            string           output       = QueryHelper.GetString("output", "");
            OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));

            // Check UIProfile
            if ((outputFormat == OutputFormatEnum.HTMLLink) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink");
            }
            else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "WebTab"))
            {
                RedirectToUIElementAccessDenied("CMS.MediaDialog", "WebTab");
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            webLinkSelector.StopProcessing = true;
            webLinkSelector.Visible        = false;
            string url = ResolveUrl(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
예제 #10
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSDialogHelper.RegisterDialogHelper(Page);
        ScriptHelper.RegisterScriptFile(Page, "Dialogs/HTMLEditor.js");
        ScriptHelper.RegisterWOpenerScript(Page);

        // Initialize page title
        pageTitle.TitleText = GetString("Widgets.Properties.Title");
        // Ensure the design mode for the dialog
        if (String.IsNullOrEmpty(aliasPath))
        {
            PortalContext.SetRequestViewMode(ViewModeEnum.Design);
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ScriptHelper.NEWWINDOW_SCRIPT_KEY, ScriptHelper.NewWindowScript);

        if (!RequestHelper.IsPostBack())
        {
            InitalizeMenu();
        }

        // If inline edit register postback for get widget data (from JS editor)
        if (inline && !isNewWidget)
        {
            if (!RequestHelper.IsPostBack())
            {
                ltlScript.Text  = ScriptHelper.GetScript("function DoHiddenPostback(){" + Page.ClientScript.GetPostBackEventReference(btnHidden, "") + "}");
                ltlScript.Text += ScriptHelper.GetScript("GetSelected('" + hdnSelected.ClientID + "');");
            }
        }
    }
예제 #11
0
    /// <summary>
    /// Creates data structure containing properties which are needed to perform mass action. This mainly includes
    /// filter values (so correct where condition can be produced), URLs of the opened dialogs, etc.
    /// </summary>
    /// <returns>Mass actions parameters</returns>
    private DocumentListMassActionsParameters GetMassActionsParameters()
    {
        return(new DocumentListMassActionsParameters
        {
            ShowAllLevels = ShowAllLevels,
            ClassID = ClassID,
            CurrentWhereCondition = CurrentWhereCondition,
            Identifier = Identifier,
            Node = Node,
            RequiresDialog = RequiresDialog,
            WOpenerNodeID = WOpenerNodeID,
            ArchiveReturnUrl = ArchiveReturnUrl,
            DeleteReturnUrl = DeleteReturnUrl,
            GetCopyMoveLinkBaseActionUrl = actionCode =>
            {
                Config.CustomFormatCode = actionCode.ToLowerCSafe();
                if (actionCode.Equals("Link", StringComparison.OrdinalIgnoreCase))
                {
                    Config.ContentSites = AvailableSitesEnum.OnlyCurrentSite;
                }

                if (!string.IsNullOrEmpty(CopyMoveLinkStartingPath))
                {
                    Config.ContentStartingPath = CopyMoveLinkStartingPath;
                }

                return CMSDialogHelper.GetDialogUrl(Config, false, null, false);
            },
            TranslateReturnUrl = TranslateReturnUrl,
            PublishReturnUrl = PublishReturnUrl,
        });
    }
예제 #12
0
    protected void btnHidden_Click(object sender, EventArgs e)
    {
        SessionHelper.SetValue("MediaSource", null);
        SessionHelper.SetValue("DialogParameters", null);
        SessionHelper.SetValue("DialogSelectedParameters", null);
        SessionHelper.SetValue("Anchors", null);
        SessionHelper.SetValue("Ids", null);
        SessionHelper.SetValue("HideLinkText", null);

        string    selected   = hdnSelected.Value;
        Hashtable tSelection = CMSDialogHelper.GetHashTableFromString(selected);

        // 'Insert link' dialog in CK editor
        if (OutputFormat == OutputFormatEnum.HTMLLink)
        {
            string    anchors  = hdnAnchors.Value;
            string    ids      = hdnIds.Value;
            ArrayList lAnchors = CMSDialogHelper.GetListFromString(anchors);
            ArrayList lIds     = CMSDialogHelper.GetListFromString(ids);
            lAnchors.Sort();
            lIds.Sort();
            SelectMediaDialog(tSelection, lAnchors, lIds);
        }
        // Dialogs in other editors
        else
        {
            SelectMediaDialog(tSelection, null, null);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterWOpenerScript(Page);
        CMSDialogHelper.RegisterDialogHelper(Page);
        ScriptHelper.RegisterScriptFile(Page, "Dialogs/HTMLEditor.js");

        // Public user is not allowed for widgets
        if (!AuthenticationHelper.IsAuthenticated())
        {
            RedirectToAccessDenied(GetString("widgets.security.notallowed"));
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), ScriptHelper.NEWWINDOW_SCRIPT_KEY, ScriptHelper.NewWindowScript);

        // Initialize page title
        PageTitle.TitleText = GetString("Widgets.Properties.Title");
        if (!RequestHelper.IsPostBack())
        {
            InitalizeMenu();
        }

        // If inline edit register postback for get widget data (from JS editor)
        if (inline && !isNewWidget)
        {
            if (!RequestHelper.IsPostBack())
            {
                ltlScript.Text  = ScriptHelper.GetScript("function DoHiddenPostback(){" + Page.ClientScript.GetPostBackEventReference(btnHidden, string.Empty) + "}");
                ltlScript.Text += ScriptHelper.GetScript("GetSelected('" + hdnSelected.ClientID + "');");
            }
        }
    }
예제 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check UIProfile
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
        {
            RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink");
        }
        else if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AnchorTab"))
        {
            RedirectToUIElementAccessDenied("CMS.MediaDialog", "AnchorTab");
        }

        // CKEditor's plugin filebrowser add custom params to url.
        // This ensures that custom params aren't validated
        if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            anchorProperties.StopProcessing = true;
            anchorProperties.Visible        = false;
            string url = ResolveUrl(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
예제 #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check UIProfile
        if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.WYSIWYGEditor", "InsertLink");
        }
        else if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "WebTab"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.MediaDialog", "WebTab");
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);
        }
        else
        {
            webLinkSelector.StopProcessing = true;
            webLinkSelector.Visible        = false;
            string url = ResolveUrl("~/CMSMessages/Error.aspx?title=" + GetString("dialogs.badhashtitle") + "&text=" + GetString("dialogs.badhashtext") + "&cancel=1");
            ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }");
        }
    }
예제 #16
0
    /// <summary>
    /// Creates data structure containing properties which are needed to perform mass action. This mainly includes
    /// filter values (so correct where condition can be produced), URLs of the opened dialogs, etc.
    /// </summary>
    /// <returns>Mass actions parameters</returns>
    private DocumentListMassActionsParameters GetMassActionsParameters()
    {
        return(new DocumentListMassActionsParameters
        {
            ShowAllLevels = ShowAllLevels,
            ClassID = ClassID,
            CurrentWhereCondition = CurrentWhereCondition,
            Identifier = Identifier,
            Node = Node,
            RequiresDialog = RequiresDialog,
            WOpenerNodeID = WOpenerNodeID,
            ArchiveReturnUrl = ArchiveReturnUrl,
            DeleteReturnUrl = DeleteReturnUrl,
            GetCopyMoveLinkBaseActionUrl = actionCode =>
            {
                Config.CustomFormatCode = actionCode.ToLowerCSafe();

                if (!string.IsNullOrEmpty(CopyMoveLinkStartingPath))
                {
                    Config.ContentStartingPath = Server.UrlEncode(CopyMoveLinkStartingPath);
                }

                return CMSDialogHelper.GetDialogUrl(Config, false, false, null, false);
            },
            TranslateReturnUrl = TranslateReturnUrl,
            PublishReturnUrl = PublishReturnUrl,
        });
    }
예제 #17
0
    /// <summary>
    /// Initializes all the nested controls.
    /// </summary>
    private void SetupControls()
    {
        ScriptHelper.RegisterJQuery(Page);
        CMSDialogHelper.RegisterDialogHelper(Page);

        // Register scripts for current code editor
        if (UseEditorScript())
        {
            ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/Dialogs/" + GetEditorFileName());
        }

        if (!RequestHelper.IsPostBack())
        {
            ltlScript.Text = ScriptHelper.GetScript("function DoHiddenPostback(){" + Page.ClientScript.GetPostBackEventReference(btnHidden, "") + "}");
            string getSelectionScript;
            if (UseEditorScript())
            {
                string clientId = QueryHelper.GetString("editor_clientid", "");
                getSelectionScript = String.Format("GetSelected('{0}','{1}', '{2}', '{3}');", hdnSelected.ClientID, hdnAnchors.ClientID, hdnIds.ClientID, ScriptHelper.GetString(clientId, false));
            }
            else
            {
                getSelectionScript = "DoHiddenPostback();";
            }

            // Wait for full load, otherwise Chrome don't loads CSS backgrounds for footer and buttons
            ScriptHelper.RegisterStartupScript(this, typeof(String), "DoHiddenPostback", String.Format("$cmsj(window).load(function() {{ {0} }});", getSelectionScript), true);
        }

        if ((OutputFormat == OutputFormatEnum.URL) || (OutputFormat == OutputFormatEnum.NodeGUID))
        {
            btnInsert.ResourceString = "general.select";
        }
        else if (OutputFormat == OutputFormatEnum.Custom)
        {
            switch (CustomOutputCode.ToLowerCSafe())
            {
            case "copy":
                btnInsert.ResourceString = "general.copy";
                break;

            case "move":
                btnInsert.ResourceString = "general.move";
                break;

            case "link":
                btnInsert.ResourceString = "general.link";
                break;

            case "linkdoc":
                btnInsert.ResourceString = "general.link";
                break;

            default:
                btnInsert.ResourceString = "general.select";
                break;
            }
        }
    }
예제 #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
        }

        string output = QueryHelper.GetString("output", "");

        bool checkUI = true;

        if ((output == "copy") || (output == "move") || (output == "relationship") || (output == "selectpath"))
        {
            checkUI = false;
        }

        if (checkUI)
        {
            string errorMessage = "";

            OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));
            if ((outputFormat == OutputFormatEnum.HTMLLink) && !CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                errorMessage = "InsertLink";
            }
            else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
            {
                errorMessage = "InsertImageOrMedia";
            }

            if (errorMessage != "")
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage);
            }

            if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "MediaLibrariesTab"))
            {
                errorMessage = "MediaLibrariesTab";
            }

            if (errorMessage != "")
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.MediaDialog", errorMessage);
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(this.Page);
            CMSDialogHelper.RegisterDialogHelper(this.Page);

            this.linkMedia.InitFromQueryString();
        }
        else
        {
            this.linkMedia.StopProcessing = true;
        }
    }
예제 #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScriptHelper.RegisterJQuery(Page);
        CMSDialogHelper.RegisterDialogHelper(Page);
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "InitResizers", "$cmsj(InitResizers());", true);

        fileSystem.InitFromQueryString();
    }
예제 #20
0
    /// <summary>
    /// Returns Javascript used for invoking 'add related document' dialog.
    /// </summary>
    public string GetAddRelatedDocumentScript()
    {
        string postbackArgument;

        if (!AllowSwitchSides && !string.IsNullOrEmpty(RelationshipName))
        {
            postbackArgument = "insertfromselectdocument";

            // Register javascript 'postback' function
            string script = "function RefreshRelatedPanel(elementId) { if (elementId != null) { __doPostBack(elementId, '" + postbackArgument + "'); } } \n";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshRelatedPanel", ScriptHelper.GetScript(script));

            // Dialog 'Select document'
            Config.EditorClientID = pnlUpdate.ClientID + ";" + hdnSelectedNodeId.ClientID;

            // Set dialog starting path
            if (!string.IsNullOrEmpty(StartingPath))
            {
                Config.ContentStartingPath = StartingPath;
            }

            string url = CMSDialogHelper.GetDialogUrl(Config, false, null, false);

            return(string.Format("modalDialog('{0}', 'contentselectnode', '90%', '85%');", url));
        }
        else
        {
            postbackArgument = "insert";

            // Register javascript 'postback' function
            ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshUpdatePanel_" + ClientID, ScriptHelper.GetScript(
                                                       "function RefreshUpdatePanel_" + ClientID + "(){ " + Page.ClientScript.GetPostBackEventReference(pnlUpdate, postbackArgument) + "; } \n"));

            // Dialog 'Add related document'
            string query = "?nodeid=" + TreeNode.NodeID;
            query = URLHelper.AddUrlParameter(query, "defaultside", DefaultSide.ToString());
            query = URLHelper.AddUrlParameter(query, "allowswitchsides", AllowSwitchSides.ToString());
            query = URLHelper.AddUrlParameter(query, "relationshipname", RelationshipName);
            query = URLHelper.AddUrlParameter(query, "externalControlID", ClientID);
            query = URLHelper.AddUrlParameter(query, "startingpath", StartingPath ?? "");

            query = query.Replace("%", "%25").Replace("/", "%2F");

            query = URLHelper.AddUrlParameter(query, "hash", QueryHelper.GetHash(query));

            string url;
            if (IsLiveSite)
            {
                url = ResolveUrl("~/CMSFormControls/LiveSelectors/RelatedDocuments.aspx" + query);
            }
            else
            {
                url = ResolveUrl("~/CMSFormControls/Selectors/RelatedDocuments.aspx" + query);
            }

            return(string.Format("modalDialog('{0}', 'AddRelatedDocument', '900', '315');", url));
        }
    }
예제 #21
0
    /// <summary>
    /// Initialize design jQuery scripts.
    /// </summary>
    private void InitializeDesignScripts()
    {
        CMSDialogHelper.RegisterDialogHelper(Page);
        StringBuilder sb = new StringBuilder();

        sb.Append("setTimeout('InitializeDesign();',10);");
        sb.Append("$cmsj(window).resize(function() { InitializeDesign(); });");
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "designScript", sb.ToString(), true);
    }
예제 #22
0
    /// <summary>
    /// Performs additional actions for the media selector.
    /// </summary>
    /// <param name="url">Base item URL</param>
    private string EnsureMediaSelector(string url)
    {
        if (ShowSizeControls)
        {
            url = CMSDialogHelper.UpdateUrl(widthHeightElem.Width, widthHeightElem.Height, DefaultWidth, DefaultHeight, url, SourceType, true);
        }

        return(EnsureExtension(txtUrl.Text, url));
    }
예제 #23
0
    protected void hdnButton_Click(object sender, EventArgs e)
    {
        string script = CMSDialogHelper.GetLinkItem(GetSelectedItem());

        if (!String.IsNullOrEmpty(script))
        {
            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "insertItemScript", ScriptHelper.GetScript(script));
        }
    }
예제 #24
0
    /// <summary>
    /// Performs additional actions for the media selector.
    /// </summary>
    /// <param name="url">Base item URL</param>
    private string EnsureMediaSelector(string url)
    {
        if (this.ShowSizeControls)
        {
            url = CMSDialogHelper.UpdateUrl(this.widthHeightElem.Width, this.widthHeightElem.Height, 0, 0, url, this.SourceType, true);
        }

        return(EnsureExtension(this.txtUrl.Text, url));
    }
예제 #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
        }

        string output = QueryHelper.GetString("output", "");

        bool checkUI = (output != "copy") && (output != "move") && (output != "relationship") && (output != "selectpath");

        if (checkUI)
        {
            string errorMessage = "";

            OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));
            if ((outputFormat == OutputFormatEnum.HTMLLink) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                errorMessage = "InsertLink";
            }
            else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
            {
                errorMessage = "InsertImageOrMedia";
            }

            if (errorMessage != "")
            {
                RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage);
            }

            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "MediaLibrariesTab"))
            {
                errorMessage = "MediaLibrariesTab";
            }

            if (errorMessage != "")
            {
                RedirectToUIElementAccessDenied("CMS.MediaDialog", errorMessage);
            }
        }

        // CKEditor's plugin filebrowser add custom params to url.
        // This ensures that custom params aren't validated
        if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);

            linkMedia.InitFromQueryString();
        }
        else
        {
            linkMedia.StopProcessing = true;
        }
    }
예제 #26
0
    /// <summary>
    /// Returns Correct URL of the path selection dialog.
    /// </summary>
    private string GetSelectionDialogUrl()
    {
        string url = CMSDialogHelper.GetDialogUrl(Config, IsLiveSite, false, null, false);

        url = URLHelper.RemoveParameterFromUrl(url, "hash");
        url = URLHelper.AddParameterToUrl(url, "selectionmode", "single");
        url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));
        url = URLHelper.EncodeQueryString(url);
        return(url);
    }
예제 #27
0
    public void InitFromQueryString()
    {
        // Get format definition from URL
        string output = QueryHelper.GetString("output", "html");
        bool   link   = QueryHelper.GetBoolean("link", false);

        OutputFormat = CMSDialogHelper.GetOutputFormat(output, link);
        if (OutputFormat == OutputFormatEnum.Custom)
        {
            CustomOutputFormat = output;
        }

        // Get selectable content
        string content = QueryHelper.GetString("content", "all");

        SelectableContent = CMSDialogHelper.GetSelectableContent(content);

        // Get user dialog configuration
        XmlData userConfig = MembershipContext.AuthenticatedUser.UserSettings.UserDialogsConfiguration;

        // Get selected tab from URL
        SelectedTab = QueryHelper.GetString("tab", (string)userConfig["selectedtab"]);

        // Get hidden tabs from URL
        bool hasFormGuid   = (QueryHelper.GetGuid("formguid", Guid.Empty) != Guid.Empty);
        bool hasDocumentId = (QueryHelper.GetInteger("documentid", 0) > 0);
        bool hasParentId   = (QueryHelper.GetInteger("parentid", 0) > 0);

        HideAttachments = QueryHelper.GetBoolean("attachments_hide", false) || !((hasFormGuid && hasParentId) || hasDocumentId || HasMetaFileObjectInfo);

        HideContent = QueryHelper.GetBoolean("content_hide", false);
        if (!HideContent)
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Content", SiteContext.CurrentSiteName))
            {
                HideContent = true;
            }
        }

        HideMediaLibraries = QueryHelper.GetBoolean("libraries_hide", false);
        if (!HideMediaLibraries)
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", SiteContext.CurrentSiteName))
            {
                HideMediaLibraries = true;
            }
        }

        HideWeb    = QueryHelper.GetBoolean("web_hide", false);
        HideAnchor = QueryHelper.GetBoolean("anchor_hide", false);
        HideEmail  = QueryHelper.GetBoolean("email_hide", false);
    }
예제 #28
0
    /// <summary>
    /// Returns Correct URL of the copy or move dialog.
    /// </summary>
    /// <param name="nodeId">ID Of the node to be copied or moved</param>
    /// <param name="CurrentAction">Action which should be performed</param>
    private string GetDialogUrl(int nodeId, Action CurrentAction)
    {
        Config.CustomFormatCode = CurrentAction.ToString().ToLower();
        string url = CMSDialogHelper.GetDialogUrl(Config, false, false, null, false);

        url = URLHelper.RemoveParameterFromUrl(url, "hash");
        url = URLHelper.AddParameterToUrl(url, "sourcenodeids", nodeId.ToString());
        url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));
        url = URLHelper.EncodeQueryString(url);

        return(url);
    }
예제 #29
0
    /// <summary>
    /// Initializes all the nested controls.
    /// </summary>
    private void SetupControls()
    {
        CMSDialogHelper.RegisterDialogHelper(this.Page);

        // Register scripts for current code editor
        if (UseEditorScript())
        {
            ScriptHelper.RegisterScriptFile(this.Page, "~/CMSScripts/Dialogs/" + GetEditorFileName());
        }

        if (!RequestHelper.IsPostBack())
        {
            ltlScript.Text = ScriptHelper.GetScript("function DoHiddenPostback(){" + Page.ClientScript.GetPostBackEventReference(btnHidden, "") + "}");
            if (UseEditorScript())
            {
                ltlScript.Text += ScriptHelper.GetScript("GetSelected('" + hdnSelected.ClientID + "','" + hdnAnchors.ClientID + "','" + hdnIds.ClientID + "','" + QueryHelper.GetString("editor_clientid", "") + "');");
            }
            else
            {
                ltlScript.Text += ScriptHelper.GetScript("DoHiddenPostback();");
            }
        }

        if ((OutputFormat == OutputFormatEnum.URL) || (OutputFormat == OutputFormatEnum.NodeGUID))
        {
            btnInsert.ResourceString = "general.select";
        }
        else if (OutputFormat == OutputFormatEnum.Custom)
        {
            switch (CustomOutputCode.ToLower())
            {
            case "copy":
                btnInsert.ResourceString = "general.copy";
                break;

            case "move":
                btnInsert.ResourceString = "general.move";
                break;

            case "link":
                btnInsert.ResourceString = "general.link";
                break;

            case "linkdoc":
                btnInsert.ResourceString = "general.link";
                break;

            default:
                btnInsert.ResourceString = "general.select";
                break;
            }
        }
    }
    /// <summary>
    /// Returns Correct URL of the link dialog.
    /// </summary>
    /// <param name="nodeId">ID Of the node to be copied or moved</param>
    private string GetLinkDialogUrl(int nodeId)
    {
        DialogConfiguration config = ProductUIHelper.GetProductDialogConfig("linkdoc", null);
        string url = CMSDialogHelper.GetDialogUrl(config, false, false, null, false);

        // Prepare url for link dialog
        url = URLHelper.RemoveParameterFromUrl(url, "hash");
        url = URLHelper.AddParameterToUrl(url, "sourcenodeids", nodeId.ToString());
        url = URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url));

        return(url);
    }