Ejemplo n.º 1
0
    /// <summary>
    /// Creates role UI element. Called when the "Add element to role" button is pressed.
    /// Expects the CreateUIElement method to be run first.
    /// </summary>
    private bool AddUIElementToRole()
    {
        // Get the role
        RoleInfo role = RoleInfoProvider.GetRoleInfo("cmsdeskadmin", SiteContext.CurrentSiteID);

        // Get the UI element
        UIElementInfo element = UIElementInfoProvider.GetUIElementInfo("MyNewModule", "MyNewElement");

        if ((role != null) && (element != null))
        {
            // Create new role UI element object
            RoleUIElementInfo newRoleElement = new RoleUIElementInfo();

            // Set the properties
            newRoleElement.RoleID    = role.RoleID;
            newRoleElement.ElementID = element.ElementID;

            // Save the role UI element
            RoleUIElementInfoProvider.SetRoleUIElementInfo(newRoleElement);

            return(true);
        }

        return(false);
    }
    /// <summary>
    /// Sets selection after action.
    /// </summary>
    /// <param name="actionName">Action name</param>
    /// <param name="elementId">Element ID</param>
    private void AfterAction(string actionName, int elementId)
    {
        UIElementInfo elemInfo = UIElementInfoProvider.GetUIElementInfo(elementId);

        if (elemInfo != null)
        {
            ContentTree.SelectPath = elemInfo.ElementIDPath;
            ContentTree.ExpandPath = elemInfo.ElementIDPath + "/";

            switch (actionName.ToLowerCSafe())
            {
            case "delete":
                // Update menu actions parameters
                SelectNode(elemInfo);
                break;

            case "moveup":
            case "movedown":
                SelectNode(elemInfo, false);
                break;

            default:
                SelectNode(elemInfo);
                break;
            }
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    /// <param name="resourceName">Resource name</param>
    /// <param name="elementName">Element name</param>
    /// <param name="transformation">Transformation object info</param>
    private String GetEditUrl(string resourceName, string elementName, TransformationInfo transformation)
    {
        var uiChild = UIElementInfoProvider.GetUIElementInfo(resourceName, elementName);

        if (uiChild != null)
        {
            string url   = String.Empty;
            string query = RequestContext.CurrentQueryString;
            // Remove parentobjectid parameter to prevent from duplicating (URL generated by UIContextHelper.GetElementUrl already contains it).
            query = URLHelper.RemoveUrlParameter(query, "parentobjectid");

            if (!DialogMode)
            {
                url = UIContextHelper.GetElementUrl(uiChild, UIContext);
                url = URLHelper.AppendQuery(url, query);
                // Remove hash parameter as it's useless in non-dialog mode.
                url = URLHelper.RemoveParameterFromUrl(url, "hash");
            }
            else
            {
                url = ApplicationUrlHelper.GetElementDialogUrl(uiChild, 0, query);
            }


            return(URLHelper.AppendQuery(url, "objectid=" + transformation.TransformationID));
        }

        return(String.Empty);
    }
Ejemplo n.º 4
0
    private string ValidateForm()
    {
        // Finds whether required fields are not empty or codename is in requested form
        string result = new Validator()
                        .NotEmpty(txtDisplayName.Text.Trim(), GetString("general.requiresdisplayname"))
                        .NotEmpty(txtName.Text.Trim(), GetString("general.requirescodename"))
                        .IsCodeName(txtName.Text.Trim(), GetString("general.invalidcodename"))
                        .Result;

        if (String.IsNullOrEmpty(result) && plcCMSVersion.Visible)
        {
            if (string.IsNullOrEmpty(versionSelector.Value.ToString()))
            {
                result = GetString("general.requirescmsversion");
            }
        }

        if (String.IsNullOrEmpty(result))
        {
            // Check if code name is unique
            UIElementInfo elemInfo = UIElementInfoProvider.GetUIElementInfo(ResourceID, txtName.Text.Trim());
            if ((elemInfo != null) && (elemInfo.ElementID != this.ElementID))
            {
                result = GetString("general.uniquecodenameerror");
            }
        }

        return(result);
    }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    /// <param name="resourceName">Resource name</param>
    /// <param name="elementName">Element name</param>
    /// <param name="transformation">Transformation object info</param>
    private String GetEditUrl(string resourceName, string elementName, TransformationInfo transformation)
    {
        var uiChild = UIElementInfoProvider.GetUIElementInfo(resourceName, elementName);

        if (uiChild != null)
        {
            string url   = String.Empty;
            string query = RequestContext.CurrentQueryString;

            if (!DialogMode)
            {
                url = UIContextHelper.GetElementUrl(uiChild, UIContext);
                url = URLHelper.AppendQuery(url, query);
            }
            else
            {
                url = UIContextHelper.GetElementDialogUrl(uiChild, 0, query);
            }


            return(URLHelper.AppendQuery(url, "objectid=" + transformation.TransformationID));
        }

        return(String.Empty);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        treeElem.OnNodeCreated += new CMSAdminControls_UI_UIProfiles_UIMenu.NodeCreatedEventHandler(menuElem_OnNodeCreated);

        // Get NOT custom conversions from UI elements
        UIElementInfo root = UIElementInfoProvider.GetRootUIElementInfo("CMS.WebAnalytics");

        if (root != null)
        {
            // Get all UI elements to filter custom reports
            DataSet dsElems = UIElementInfoProvider.GetUIElements("ElementIDPath LIKE '" + DataHelper.EscapeLikeQueryPatterns(root.ElementIDPath, true, true, true) + "/%'", String.Empty, 0, "ElementName,ElementTargetUrl");
            if (!DataHelper.DataSourceIsEmpty(dsElems) && (dsElems.Tables.Count > 0))
            {
                // Condition for custom reports
                customWhereCondition = "StatisticsCode NOT IN (";
                foreach (DataRow dr in dsElems.Tables[0].Rows)
                {
                    string codeName = ValidationHelper.GetString(dr["ElementName"], String.Empty);
                    customWhereCondition += "N'" + SqlHelperClass.GetSafeQueryString(codeName, false) + "',";
                }

                // Add special cases - dont want to show them in UI or Custom report section
                customWhereCondition += additionalConversions.Replace(';', ',');

                customWhereCondition  = customWhereCondition.TrimEnd(new char[] { ',' });
                customWhereCondition += ")";

                // Filter AB Testing
                customWhereCondition += " AND (StatisticsCode NOT LIKE 'abconversion;%') AND (StatisticsCode NOT LIKE 'mvtconversion;%') AND (StatisticsCode NOT LIKE 'campconversion;%') ";
            }
        }
    }
    public override void OnInit()
    {
        Control.OnNodeCreated += Control_OnNodeCreated;

        // Get NOT custom conversions from UI elements
        UIElementInfo root = UIElementInfoProvider.GetRootUIElementInfo("CMS.WebAnalytics");

        if (root != null)
        {
            // Get all UI elements to filter custom reports
            DataSet data = UIElementInfoProvider.GetUIElements("ElementIDPath LIKE '" + SqlHelper.EscapeLikeQueryPatterns(root.ElementIDPath) + "/%'", String.Empty, 0, "ElementName,ElementTargetUrl");
            if (!DataHelper.DataSourceIsEmpty(data) && (data.Tables.Count > 0))
            {
                // Condition for custom reports
                customWhereCondition = "StatisticsCode NOT IN (";
                foreach (DataRow dr in data.Tables[0].Rows)
                {
                    string codeName = ValidationHelper.GetString(dr["ElementName"], String.Empty);
                    customWhereCondition += "N'" + SqlHelper.GetSafeQueryString(codeName, false) + "',";
                }

                // Add special cases - don't want to show them in UI or Custom report section
                customWhereCondition += additionalConversions.Replace(';', ',');

                customWhereCondition  = customWhereCondition.TrimEnd(new[] { ',' });
                customWhereCondition += ")";

                // Filter AB Testing
                customWhereCondition += " AND (StatisticsCode NOT LIKE 'abconversion;%') AND (StatisticsCode NOT LIKE 'mvtconversion;%') AND (StatisticsCode NOT LIKE 'campconversion;%') " +
                                        "AND (StatisticsCode NOT LIKE 'absessionconversionfirst;%') AND (StatisticsCode NOT LIKE 'absessionconversionrecurring;%') " +
                                        "AND (StatisticsCode NOT LIKE 'abvisitfirst;%')  AND (StatisticsCode NOT LIKE 'abvisitreturn;%') AND (StatisticsCode <> N'campaign') and (StatisticsCode <> N'conversion') ";
            }
        }
    }
    /// <summary>
    /// Displays warning message in "Design mode".
    /// </summary>
    /// <param name="message">Message that will be displayed. Default misconfiration message is used when no parameter is given.</param>
    private bool DisplayMessage(string message = null)
    {
        // Error label is displayed in Design mode when LinkedIn is disabled
        if (PortalContext.IsDesignMode(PortalContext.ViewMode))
        {
            if (String.IsNullOrEmpty(message))
            {
                // Default message informing about misconfiguration is dispalyed.
                StringBuilder parameter = new StringBuilder();
                parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> ");
                parameter.Append(GetString("settingscategory.cmsmembership") + " -> ");
                parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> ");
                parameter.Append(GetString("settingscategory.cmslinkedin"));
                if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
                {
                    // Make it link for Admin
                    parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(ApplicationUrlHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">");
                    parameter.Append("</a>");
                }

                message = String.Format(GetString("mem.linkedin.disabled"), parameter);
            }
            lblError.Text    = message;
            lblError.Visible = true;
        }

        return(lblError.Visible);
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!StopProcessing && !URLHelper.IsPostback())
        {
            int shift = -1;
            string where = String.Empty;
            if (ModuleID != 0)
            {
                where = "ElementResourceID = " + ModuleID;
            }

            if (!String.IsNullOrEmpty(WhereCondition))
            {
                where = SqlHelper.AddWhereCondition(where, WhereCondition);
            }

            // Get the data
            DataSet ds = UIElementInfoProvider.GetUIElements(where, "ElementOrder", 0, "ElementID, ElementParentID, ElementDisplayName, ElementOrder, ElementLevel");
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                gds = new GroupedDataSource(ds, "ElementParentID");

                FillDropDownList(shift, 0);
            }
        }
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Gets and bulk updates UI elements. Called when the "Get and bulk update elements" button is pressed.
    /// Expects the CreateUIElement method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateUIElements()
    {
        // Prepare the parameters
        string where = "ElementName LIKE N'MyNewElement%'";

        // Get the data
        DataSet elements = UIElementInfoProvider.GetUIElements(where, null);

        if (!DataHelper.DataSourceIsEmpty(elements))
        {
            // Loop through the individual items
            foreach (DataRow elementDr in elements.Tables[0].Rows)
            {
                // Create object from DataRow
                UIElementInfo modifyElement = new UIElementInfo(elementDr);

                // Update the properties
                modifyElement.ElementDisplayName = modifyElement.ElementDisplayName.ToUpper();

                // Save the changes
                UIElementInfoProvider.SetUIElementInfo(modifyElement);
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 11
0
    protected void SetRootNode()
    {
        if (String.IsNullOrEmpty(ElementName))
        {
            // Get the root UI element
            root = UIElementInfoProvider.GetRootUIElementInfo(ModuleName);
        }
        else
        {
            // Get the specified element
            root = UIElementInfoProvider.GetUIElementInfo(ModuleName, ElementName);
        }

        string codeName = root.ElementName.Replace(".", String.Empty).ToLowerCSafe();
        string caption  = ResHelper.LocalizeString(!String.IsNullOrEmpty(root.ElementCaption) ? root.ElementCaption : root.ElementDisplayName);
        string rootIcon = DisplayRootIcon ? GetImageUrl(root.ElementIconPath) : "";
        string rootUrl  = !String.IsNullOrEmpty(RootTargetURL) ? GetUrl(RootTargetURL) : GetUrl(root.ElementTargetURL);
        string rootText = devIcon + caption;

        if (EnableRootSelect)
        {
            rootText = String.Format("{0}<a href=\"{1}\" target=\"{2}\"><span id=\"node_{3}\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\"><span class=\"Name\">{4}</span></span></a>", devIcon, rootUrl, TargetFrame, codeName, caption);
            treeElem.SetRoot(rootText, root.ElementID.ToString(), rootIcon, rootUrl, TargetFrame);
            treeElem.EnableRootAction = true;
        }
        else
        {
            treeElem.SetRoot(rootText, root.ElementID.ToString(), rootIcon);
        }

        treeElem.ExpandPath = root.ElementIDPath;
    }
Ejemplo n.º 12
0
    /// <summary>
    /// Prepares JSON object to be inserted to the breadcrumbs. This object will be used when updating breadcrumbs after changing display name of the campaign.
    /// </summary>
    /// <returns>List of objects containing breadcrumb for root element and single campaign.</returns>
    private object GetBreadcrumbsData()
    {
        var breadcrumbsList = new List <object>();
        var application     = UIContext.UIElement.Application;

        // Root application
        string rootRedirectUrl = UrlResolver.ResolveUrl(ApplicationUrlHelper.GetApplicationUrl(application));

        breadcrumbsList.Add(new
        {
            text        = MacroResolver.Resolve(application.ElementDisplayName),
            redirectUrl = rootRedirectUrl,
            isRoot      = true
        });

        // (Campaign)
        breadcrumbsList.Add(new
        {
            suffix = ResHelper.GetString("analytics.campaign")
        });


        return(new
        {
            data = breadcrumbsList,
            pin = new
            {
                elementGuid = UIElementInfoProvider.GetUIElementInfo(UIContext.UIElement.ElementParentID).ElementGUID,
                applicationGuid = application.ElementGUID,
                objectType = CampaignInfo.OBJECT_TYPE
            }
        });
    }
    protected void SetRootNode()
    {
        if (String.IsNullOrEmpty(ElementName))
        {
            // Get the root UI element
            root = UIElementInfoProvider.GetRootUIElementInfo(ModuleName);
        }
        else
        {
            // Get the specified element
            root = UIElementInfoProvider.GetUIElementInfo(ModuleName, ElementName);
        }

        string codeName = root.ElementName.Replace(".", String.Empty).ToLowerCSafe();
        string caption  = UIElementInfoProvider.GetElementCaption(root);
        string rootUrl  = !String.IsNullOrEmpty(RootTargetURL) ? GetUrl(RootTargetURL) : GetUrl(root.ElementTargetURL);

        string rootText = caption + DevIcon;

        if (EnableRootSelect)
        {
            rootText = String.Format("<a href=\"{0}\" target=\"{1}\"><span id=\"node_{2}\" name=\"treeNode\" class=\"ContentTreeItem ContentTreeSelectedItem\"><span class=\"Name\">{3}</span></span></a>", rootUrl, TargetFrame, codeName, caption);
            treeElem.SetRoot(rootText, root.ElementID.ToString(), null, rootUrl, TargetFrame);
            treeElem.EnableRootAction = true;
        }
        else
        {
            treeElem.SetRoot(rootText, root.ElementID.ToString(), null);
        }

        treeElem.ExpandPath = root.ElementIDPath;
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Handles the OnAfterSave event of the EditForm control.
    /// </summary>
    protected void EditForm_OnAfterSave(object sender, EventArgs ea)
    {
        String saveScript = AfterSaveScript;

        if (saveScript != String.Empty)
        {
            ScriptHelper.RegisterClientScriptBlock(this, typeof(String), "aftersavescript", ScriptHelper.GetScript(saveScript));
        }
        else
        {
            if (!String.IsNullOrEmpty(RedirectURL))
            {
                URLHelper.Redirect(RedirectURL);
            }

            if (newItem)
            {
                String url = RedirectURL;
                if (String.IsNullOrEmpty(RedirectURL))
                {
                    // Find element representing new object
                    UIElementInfo uiPar = UIElementInfoProvider.GetUIElementInfo(UIContext.UIElement.ElementParentID);
                    if (uiPar != null)
                    {
                        // Append parameters
                        url = UIContextHelper.GetElementUrl(uiPar.GetEditElement(), UIContext);
                        url = URLHelper.AppendQuery(url, "objectid=" + EditForm.EditedObject.Generalized.ObjectID + "&saved=1");

                        // Ensure that the redirected edit page will behave as a top dialog page (hide breadcrumbs, uses dialog page title...)
                        url = URLHelper.RemoveParameterFromUrl(url, "rootelementid");

                        // Append action edit parameter
                        url = URLHelper.AddParameterToUrl(url, "action", "edit");
                    }
                }

                // Ensure hash for dialog mode
                url = UIContextHelper.AppendDialogHash(UIContext, url);

                EditForm.RedirectUrlAfterSave = url;
            }
        }

        // Raise the javascript return handler function
        RaiseReturnHandler();

        if (itemChanged)
        {
            String refreshWopener = String.Empty;

            // Refresh opener for dialog page.
            if (IsDialog)
            {
                refreshWopener = "if(wopener!=null) {if (wopener.Refresh != null) {wopener.Refresh()} else if (wopener.RefreshPage != null) wopener.RefreshPage();}";
            }

            ScriptHelper.RegisterClientScriptBlock(Page, typeof(String), "RefreshParent", ScriptHelper.GetScript(refreshWopener + "if (parent.refreshPage) {parent.refreshPage()} else parent.location = parent.location;"));
        }
    }
Ejemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get query parameters
        int moduleId  = QueryHelper.GetInteger("moduleid", 0);
        int elementId = QueryHelper.GetInteger("elementid", 0);
        int parentId  = QueryHelper.GetInteger("parentid", 0);

        string currentElement = "";

        // Get current element display name
        UIElementInfo elemInfo = UIElementInfoProvider.GetUIElementInfo(elementId);

        if (elemInfo != null)
        {
            currentElement = elemInfo.ElementDisplayName;
        }

        // Setup breadcrumbs
        string[,] pageTitleTabs = new string[2, 3];
        pageTitleTabs[0, 0]     = GetString("resource.ui.element");
        pageTitleTabs[0, 1]     = "~/CMSModules/Modules/Pages/Development/Module_UI_Frameset.aspx?moduleid=" + moduleId;
        pageTitleTabs[0, 2]     = "content";
        pageTitleTabs[1, 0]     = ResHelper.LocalizeString(currentElement);
        pageTitleTabs[1, 1]     = "";
        pageTitleTabs[1, 2]     = "";
        this.CurrentMaster.Title.Breadcrumbs = pageTitleTabs;

        // Setup Tabs if no creating and no parent element
        if (parentId > 0)
        {
            string[,] tabs = new string[2, 4];
            tabs[0, 0]     = GetString("general.general");
            tabs[0, 1]     = "SaveTab(0);SetHelpTopic('helpTopic', 'resource_ui_general');";
            tabs[0, 2]     = "Module_UI_General.aspx?moduleID=" + moduleId + "&elementId=" + elementId + "&parentId=" + parentId;
            tabs[1, 0]     = GetString("general.roles");
            tabs[1, 1]     = "SaveTab(1);SetHelpTopic('helpTopic', 'resource_ui_roles');";
            tabs[1, 2]     = "Module_UI_Roles.aspx?moduleID=" + moduleId + "&elementId=" + elementId + "&parentId=" + parentId;

            this.CurrentMaster.Tabs.Tabs      = tabs;
            this.CurrentMaster.Tabs.UrlTarget = "editcontent";

            int selectedTab = QueryHelper.GetInteger("tabindex", 0);
            this.CurrentMaster.Tabs.SelectedTab = selectedTab;

            if (selectedTab == 0)
            {
                this.CurrentMaster.Title.HelpTopicName = "resource_ui_general";
            }
            else
            {
                this.CurrentMaster.Title.HelpTopicName = "resource_ui_roles";
            }
            this.CurrentMaster.Title.HelpName = "helpTopic";

            this.CurrentMaster.HeadElements.Visible = true;
            this.CurrentMaster.HeadElements.Text    = ScriptHelper.GetScript("function SaveTab(tabIndex){\n if ((window.parent != null) && (window.parent.parent != null) && (window.parent.parent.frames['tree'])){\n window.parent.parent.frames['tree'].setTab(tabIndex);\n}}");
        }
    }
    /// <summary>
    /// Handles btnOK's OnClick event - Update resource info.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Finds whether required fields are not empty
        string result = new Validator().NotEmpty(tbModuleDisplayName.Text.Trim(), GetString("Administration-Module_New.ErrorEmptyModuleDisplayName")).NotEmpty(tbModuleCodeName.Text, GetString("Administration-Module_New.ErrorEmptyModuleCodeName"))
                        .IsCodeName(tbModuleCodeName.Text, GetString("general.invalidcodename"))
                        .Result;

        if (result == "")
        {
            // Check unique name
            ResourceInfo ri = ResourceInfoProvider.GetResourceInfo(tbModuleCodeName.Text);
            if ((ri == null) || (ri.ResourceId == moduleId))
            {
                // Get object
                if (ri == null)
                {
                    ri = ResourceInfoProvider.GetResourceInfo(moduleId);
                    if (ri == null)
                    {
                        ri = new ResourceInfo();
                    }
                }

                // Update resource info
                ri.ResourceId          = moduleId;
                ri.ResourceName        = tbModuleCodeName.Text;
                ri.ResourceDescription = txtModuleDescription.Text.Trim();
                ri.ResourceDisplayName = tbModuleDisplayName.Text.Trim();

                ResourceInfoProvider.SetResourceInfo(ri);

                // Update root UIElementInfo of the module
                UIElementInfo elemInfo = UIElementInfoProvider.GetRootUIElementInfo(ri.ResourceId);
                if (elemInfo == null)
                {
                    elemInfo = new UIElementInfo();
                }
                elemInfo.ElementResourceID  = ri.ResourceId;
                elemInfo.ElementDisplayName = ri.ResourceDisplayName;
                elemInfo.ElementName        = ri.ResourceName.ToLowerCSafe().Replace(".", "");
                elemInfo.ElementIsCustom    = false;
                UIElementInfoProvider.SetUIElementInfo(elemInfo);

                // Show message
                ShowChangesSaved();
            }
            else
            {
                // Show error message
                ShowError(GetString("Administration-Module_New.UniqueCodeName"));
            }
        }
        else
        {
            // Show error message
            ShowError(result);
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            Visible = false;
        }
        else
        {
            if (SystemContext.IsFullTrustLevel)
            {
                // Check if OpenID module is enabled
                if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOpenID"))
                {
                    ltlScript.Text = ScriptHelper.GetIncludeScript(PROVIDERS_LOCATION + "OpenIDSelector.js");
                    lblError.Text  = GetString("openid.invalidid");

                    SetProviders();
                    DisplayButtons();

                    openIDhelper = new CMSOpenIDHelper();
                    CheckStatus();
                }
                else
                {
                    // Error label is displayed in Design mode when OpenID is disabled
                    if (PortalContext.IsDesignMode(PortalContext.ViewMode))
                    {
                        StringBuilder parameter = new StringBuilder();
                        parameter.Append(UIElementInfoProvider.GetApplicationNavigationString("cms", "Settings") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembership") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsmembershipauthentication") + " -> ");
                        parameter.Append(GetString("settingscategory.cmsopenid"));
                        if (MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin))
                        {
                            // Make it link for Admin
                            parameter.Insert(0, "<a href=\"" + URLHelper.GetAbsoluteUrl(UIContextHelper.GetApplicationUrl("cms", "settings")) + "\" target=\"_top\">");
                            parameter.Append("</a>");
                        }

                        lblError.Text    = String.Format(GetString("mem.openid.disabled"), parameter.ToString());
                        lblError.Visible = true;
                        txtInput.Visible = false;
                    }
                    else
                    {
                        Visible = false;
                    }
                }
            }
            // Error label is displayed in Design mode when OpenID library is not enabled
            else
            {
                lblError.Text    = ResHelper.GetString("socialnetworking.fulltrustrequired");
                lblError.Visible = true;
                txtInput.Visible = false;
            }
        }
    }
 protected void btnMoveDown_Click(object sender, EventArgs e)
 {
     GetHiddenValue();
     if (ElementId > 0)
     {
         UIElementInfoProvider.MoveUIElementDown(ElementId);
         AfterAction("movedown", ElementId);
     }
 }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    private String GetEditUrl()
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.CustomTables", "EditTransformation");
        if (uiChild != null)
        {
            return URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, UIContext), "displaytitle=false");
        }

        return String.Empty;
    }
Ejemplo n.º 20
0
    /// <summary>
    /// Deletes UI element. Called when the "Delete element" button is pressed.
    /// Expects the CreateUIElement method to be run first.
    /// </summary>
    private bool DeleteUIElement()
    {
        // Get the UI element
        UIElementInfo deleteElement = UIElementInfoProvider.GetUIElementInfo("MyNewModule", "MyNewElement");

        // Delete the UI element
        UIElementInfoProvider.DeleteUIElementInfo(deleteElement);

        return(deleteElement != null);
    }
    /// <summary>
    /// Gets URL where the page should be redirected after the unsubscription save.
    /// </summary>
    /// <returns>Relative URL navigating to the unsubscription listing page.</returns>
    private string GetRedirectUrl()
    {
        // Get URL of the unsubscription listing page
        var uiElement = UIElementInfoProvider.GetUIElementInfo(new Guid("C0B4B02A-F628-4204-9390-6CD9D9AE7125"));

        return(UIContextHelper.GetElementUrl(
                   uiElement,
                   displayTitle: false /* Ensure the black strip header won't be displayed */
                   ));
    }
Ejemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(this.ModuleName))
        {
            // Reserve UI tabs
            DataRow sdr = SecurityHelper.ReserveSecurityLogItem("LoadUIGuide");

            // Get UI elements which represent the guide items
            DataSet ds = null;
            if (String.IsNullOrEmpty(this.ElementName))
            {
                ds = UIElementInfoProvider.GetUIMenuElements(this.ModuleName);
            }
            else
            {
                ds = UIElementInfoProvider.GetChildUIElements(this.ModuleName, this.ElementName);
            }

            // Create guide item collection
            CurrentUserInfo currentUser = CMSContext.CurrentUser;
            int             i           = 0;
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                ArrayList guideParams = new ArrayList(4);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string elementName = ValidationHelper.GetString(dr["ElementName"], "");

                    if (currentUser.IsAuthorizedPerUIElement(this.ModuleName, elementName, this.ModuleAvailabilityForSiteRequired))
                    {
                        // Get parameters of the guide item
                        object itemParams = GetGuideItemParameters(new UIElementInfo(dr));

                        // If item initialized, add it to the collection
                        if (itemParams != null)
                        {
                            guideParams.Add(itemParams);
                            i++;
                        }
                    }
                }

                // Initialize guide
                guideElem.Parameters = guideParams;
                guideElem.Columns    = this.Columns;
            }

            // Log the security
            if (sdr != null)
            {
                SecurityHelper.SetLogItemData(sdr, currentUser.UserName, this.ModuleName, this.ElementName, i, CMSContext.CurrentSiteName);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        String text    = String.Empty;
        String url     = TargetUrl;
        bool   enabled = true;
        String onClick = String.Empty;

        // If new element is set, load it directly, otherwise use first element with prefix 'new' in its name.
        UIElementInfo uiNew = String.IsNullOrEmpty(NewElement) ? UIContext.UIElement.GetNewElement() :
                              UIElementInfoProvider.GetUIElementInfo(UIContext.UIElement.ElementResourceID, NewElement);

        bool   openInDialog = false;
        String dialogWidth  = null;
        String dialogHeight = null;

        if (uiNew != null)
        {
            UIContextData data = new UIContextData();
            data.LoadData(uiNew.ElementProperties);
            text    = UIElementInfoProvider.GetElementCaption(uiNew);
            enabled = UIContextHelper.CheckElementVisibilityCondition(uiNew);
            url     = ContextResolver.ResolveMacros(UIContextHelper.GetElementUrl(uiNew, UIContext));

            openInDialog = data["OpenInDialog"].ToBoolean(false);
            dialogWidth  = data["DialogWidth"].ToString(null);
            dialogHeight = data["DialogHeight"].ToString(null);

            // Set on-click for JavaScript type
            if (uiNew.ElementType == UIElementTypeEnum.Javascript)
            {
                onClick = url;
                url     = String.Empty;
            }
            else
            {
                // For URL append dialog hash if needed
                url = UIContextHelper.AppendDialogHash(UIContext, url);
            }
        }

        // If url is non empty add action
        if (((url != String.Empty) || (onClick != String.Empty)) && (HeaderActions != null))
        {
            HeaderActions.AddAction(new HeaderAction()
            {
                Text          = GetString(text),
                RedirectUrl   = url,
                Enabled       = enabled,
                OnClientClick = onClick,
                OpenInDialog  = openInDialog,
                DialogWidth   = dialogWidth,
                DialogHeight  = dialogHeight
            });
        }
    }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    private String GetEditUrl()
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.DocumentEngine", "EditQuery");

        if (uiChild != null)
        {
            return(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, UIContext), "displaytitle=false"));
        }

        return(String.Empty);
    }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    private String GetEditUrl()
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.BannerManagement", "EditBannerCategory");

        if (uiChild != null)
        {
            return(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, false), "objectid={0}&siteid={%SelectedSiteID%}"));
        }

        return(String.Empty);
    }
 /// <summary>
 /// Set path to preselected item
 /// </summary>
 private void HandleThePreselection()
 {
     if (!String.IsNullOrEmpty(SelectedNode))
     {
         UIElementInfo uiElement = UIElementInfoProvider.GetUIElementInfo(ModuleName, SelectedNode);
         if (uiElement != null)
         {
             treeElem.ExpandPath = uiElement.ElementIDPath;
         }
     }
 }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    /// <param name="classId">Class info identifier</param>
    /// <param name="formId">Alternative form identifier</param>
    private String GetEditUrl(int classId, int formId)
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.DocumentEngine", "EditAlternativeForm");

        if (uiChild != null)
        {
            return(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, UIContext), "displaytitle=false&objectid=" + formId + "&parentobjectid=" + classId));
        }

        return(String.Empty);
    }
Ejemplo n.º 28
0
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    private String GetEditUrl()
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.MediaLibrary", "Group.EditMediaLibrary");

        if (uiChild != null)
        {
            return(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, UIContext), "displaytitle=false&objectid={%EditedObject.ID%}&parentobjectid=" + elemEdit.MediaLibraryGroupID));
        }

        return(String.Empty);
    }
    /// <summary>
    /// Creates URL for editing.
    /// </summary>
    private String GetEditUrl()
    {
        UIElementInfo uiChild = UIElementInfoProvider.GetUIElementInfo("CMS.BannerManagement", "EditBanner");

        if (uiChild != null)
        {
            return(URLHelper.AppendQuery(UIContextHelper.GetElementUrl(uiChild, UIContext), "objectid={0}&siteid={%SelectedSiteID%}&parentobjectid={?parentobjectid?}&displaytitle=false"));
        }

        return(String.Empty);
    }
    /// <summary>
    /// Page load event handler
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        pnlButtons.Visible = ShowTemplateButtons;
        btnClear.Visible   = DisplayClearButton;

        var template = PageTemplateInfo;

        if (template != null)
        {
            int templateId = template.PageTemplateId;

            // Hide Clone as AdHoc button for page templates when is used for UIElement edit page and UIElement does not exists
            var uiElement = Form?.EditedObject as UIElementInfo;
            plcUIClone.Visible = uiElement != null ? (template.IsReusable && UIElementInfoProvider.GetUIElementInfo(uiElement.ElementID) != null) : template.IsReusable;

            if (Enabled)
            {
                // Add root category filter
                String root = !String.IsNullOrEmpty(RootCategoryName) ? "&startingpath=" + RootCategoryName : "";

                // Set buttons
                btnSave.OnClientClick = String.Format(
                    "modalDialog('{0}?selectorid={1}{2}&templateId={3}&siteid={4}', 'SaveNewTemplate', 700, 400); return false;",
                    ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx"),
                    ClientID,
                    root,
                    templateId,
                    SiteContext.CurrentSiteID
                    );

                // Edit button
                string url = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", templateId);

                btnEditTemplateProperties.OnClientClick = String.Format("modalDialog('{0}', 'Template edit', '95%', '95%'); return false;", url);

                btnClone.OnClientClick = String.Format(
                    "if (confirm({0})) {1};return false;",
                    ScriptHelper.GetString(GetString("pageselector.cloneasadhoc")),
                    Page.ClientScript.GetPostBackEventReference(btnFullPostback, null)
                    );
            }
        }
        else
        {
            pnlButtons.Visible = false;
        }

        SetButtonsOnClick();

        if (RequestHelper.IsPostBack() && (hdnSelected.Value == ""))
        {
            hdnSelected.Value = Request.Form[hdnSelected.UniqueID];
        }
    }