/// <summary>
    /// Groups created event handler.
    /// </summary>
    protected void ucUIToolbar_OnGroupsCreated(object sender, List <Group> groups)
    {
        if (!IsPageNotFound)
        {
            // Replace Culture button
            Group culture = groups.Find(g => g.CssClass.Contains("OnSiteCultures"));
            if (culture != null)
            {
                // Hide culture selector when there is only one culture for the current site
                InfoDataSet <CultureInfo> sites = CultureInfoProvider.GetSiteCultures(CMSContext.CurrentSiteName);
                if ((sites.Tables[0].Rows.Count < 2) ||
                    (IsPageNotFound && OnSiteEditHelper.PageInfoForPageNotFound.NodeID == 0))
                {
                    // Remove the culture button
                    groups.Remove(culture);
                }
                else
                {
                    culture.ControlPath = "~/CMSAdminControls/UI/UniMenu/OnSiteEdit/CultureMenu.ascx";
                }
            }

            // Replace Device profile button
            Group deviceProfile = groups.Find(g => g.CssClass.Contains("OnSiteDeviceProfile"));
            if (deviceProfile != null)
            {
                // Hide device profile selector when there is only one device defined or device profile module is disabled
                if (!DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName))
                {
                    // Remove the device profile button
                    groups.Remove(deviceProfile);
                }
                else
                {
                    deviceProfile.ControlPath = "~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx";
                }
            }

            // Replace the Highlight and Hidden buttons
            Group otherGroup = groups.Find(g => g.CssClass.Contains("OnSiteOthers"));
            if (otherGroup != null)
            {
                otherGroup.ControlPath = "~/CMSAdminControls/UI/UniMenu/OnSiteEdit/OtherMenu.ascx";
            }

            // Use a specific css class for the large CMSDesk button
            if (largeCMSDeskButton)
            {
                Group adminsGroup = groups.Find(g => g.CssClass.Contains("OnSiteAdmins"));
                if (adminsGroup != null)
                {
                    adminsGroup.CssClass += " BigCMSDeskButton";
                }
            }
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        imgShow.ImageUrl       = GetImageUrl("CMSModules/CMS_Content/ContextMenu/refresh.png");
        imgShow.ToolTip        = GetString("general.refresh");
        ucPath.UseImageButtons = true;

        TrimPreviewValues();
        ProcessLanguageAndDeviceChange();
        pnlDevice.Visible = DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName);

        if (PreviewObjectName != String.Empty)
        {
            String script = "function ChangeLanguage(culture) {" + ControlsHelper.GetPostBackEventReference(btnLanguage, "#").Replace("'#'", "culture") + "}";
            script += "function ChangeDevice(device) {" + ControlsHelper.GetPostBackEventReference(btnDevice, "#").Replace("'#'", "device") + "}";
            ScriptHelper.RegisterClientScriptBlock(this, typeof(String), "PostbackScript", ScriptHelper.GetScript(script));
        }
    }
Пример #3
0
    /// <summary>
    /// Init event handler.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        // Show devices selection button
        if (DeviceProfileInfoProvider.IsDeviceProfilesEnabled(SiteContext.CurrentSiteName) && LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.DeviceProfiles))
        {
            ucProfiles = LoadControl("~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx") as InlineUserControl;
            if (ucProfiles != null)
            {
                ucProfiles.ID = "ucProfiles";
                ucProfiles.SetValue("UseSmallButton", true);
                ucProfiles.SetValue("DisplayRotateButtons", true);
                plcDevice.Controls.Add(ucProfiles);
                plcDevice.Visible = true;
            }
        }
        else
        {
            plcDevice.Visible = false;
        }

        base.OnInit(e);
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (PageTemplate != null)
        {
            // Initialize page title
            string title = GetString("Administration-PageTemplate_Header.TemplateProperties");

            // Check if the object exists - if not->redirect and inform the user
            EditedObject = PageTemplate;

            PageTemplateCategoryInfo categoryInfo = PageTemplateCategoryInfoProvider.GetPageTemplateCategoryInfo(PageTemplate.CategoryID);
            string currentPageTemplate            = HTMLHelper.HTMLEncode(PageTemplate.DisplayName);
            string[,] breadcrumbs;

            if (!isDialog)
            {
                breadcrumbs = new string[3, 4];

                breadcrumbs[0, 0] = GetString("development.pagetemplates");
                breadcrumbs[0, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/Category_Frameset.aspx");
                breadcrumbs[0, 2] = "_parent";
                breadcrumbs[0, 3] = "if (parent.parent.frames['pt_tree']) { parent.parent.frames['pt_tree'].location.href = '" + URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Tree.aspx") + "'; }";

                if (categoryInfo != null)
                {
                    breadcrumbs[1, 0] = HTMLHelper.HTMLEncode(categoryInfo.DisplayName);
                    breadcrumbs[1, 1] = URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/Category_Frameset.aspx?categoryid=" + PageTemplate.CategoryID);
                    breadcrumbs[1, 2] = "_parent";
                    breadcrumbs[1, 3] = "if (parent.parent.frames['pt_tree']) { parent.parent.frames['pt_tree'].location.href = '" + URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Tree.aspx?categoryid=" + PageTemplate.CategoryID) + "'; }";

                    breadcrumbs[2, 0] = HTMLHelper.HTMLEncode(currentPageTemplate);
                    breadcrumbs[2, 1] = "";
                    breadcrumbs[2, 2] = "";
                }
            }
            else
            {
                breadcrumbs = new string[2, 3];

                breadcrumbs[0, 0] = GetString("development.pagetemplates");
                breadcrumbs[0, 1] = "";
                breadcrumbs[0, 2] = "";

                breadcrumbs[1, 0] = HTMLHelper.HTMLEncode(currentPageTemplate);
                breadcrumbs[1, 1] = "";
                breadcrumbs[1, 2] = "";

                if (PageTemplate.IsReusable)
                {
                    CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_PageTemplates/pagetemplate.png");
                }
                else
                {
                    CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_PageTemplates/adhoc.png");
                }
                CurrentMaster.Title.TitleText = title;
            }

            CurrentMaster.Title.Breadcrumbs   = breadcrumbs;
            CurrentMaster.Title.HelpTopicName = "general_tab12";
            CurrentMaster.Title.HelpName      = "helpTopic";

            // Initialize menu
            int    i = 0;
            string defaultDeviceProfileQuery = "&devicename=default&ObjectLifeTime=request";

            string dialog = String.Empty;
            if (isDialog)
            {
                dialog = "&dialog=1";
            }

            // General tab
            SetTab(i, GetString("general.general"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_General.aspx?templateid=" + PageTemplateID + dialog), "SetHelpTopic('helpTopic', 'general_tab12');");
            i++;

            bool showDesign = ((PageTemplate.PageTemplateType == PageTemplateTypeEnum.Portal) || (PageTemplate.PageTemplateType == PageTemplateTypeEnum.Dashboard));

            // Design tab
            if (!isDialog && showDesign)
            {
                SetTab(i, GetString("edittabs.design"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Design.aspx?templateid=" + PageTemplateID + defaultDeviceProfileQuery), "SetHelpTopic('helpTopic', 'design_tab2');");
                i++;
            }

            if (showDesign)
            {
                string aliasPath = QueryHelper.GetString("aliaspath", string.Empty);
                string query     = string.IsNullOrEmpty(aliasPath) ? "" : "&aliasPath=" + aliasPath;
                query += defaultDeviceProfileQuery;

                // Layouts tab
                SetTab(i, GetString("Administration-PageTemplate_Header.Layouts"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageLayouts/PageLayout_Edit.aspx?allowswitch=1&templateid=" + PageTemplateID + dialog + query), "SetHelpTopic('helpTopic', 'layout');");
                i++;

                // Show the Device layouts tab
                bool deviceProfilesEnabled = DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName);
                if (deviceProfilesEnabled && (PageTemplate.PageTemplateType == PageTemplateTypeEnum.Portal))
                {
                    // Device layouts tab
                    SetTab(i, "Device layouts", URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_DeviceLayouts.aspx?templateid=" + PageTemplateID + dialog + query), "SetHelpTopic('helpTopic', 'device_layouts');");
                    i++;
                }
            }

            CurrentUserInfo user = CMSContext.CurrentUser;
            if (!isDialog && (PageTemplate.IsReusable) && user.UserSiteManagerAdmin)
            {
                // Sites tab
                SetTab(i, GetString("general.sites"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Sites.aspx?templateid=" + PageTemplateID), "SetHelpTopic('helpTopic', 'sites_tab2');");
                i++;

                if (PageTemplate.PageTemplateType != PageTemplateTypeEnum.Dashboard)
                {
                    // Scopes tab
                    SetTab(i, GetString("pagetemplate.edit.scopes"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/Scopes/PageTemplateScopes_List.aspx?templateid=" + PageTemplateID), "SetHelpTopic('helpTopic', 'page_templates_scopes');");
                    i++;
                }
            }

            if (showDesign && PageTemplate.IsReusable && !StorageHelper.IsExternalStorage(PageTemplate.GetThemePath()) && user.UserSiteManagerAdmin)
            {
                // Theme tab
                SetTab(i, GetString("Stylesheet.Theme"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Theme.aspx?templateid=" + PageTemplateID + dialog), "SetHelpTopic('helpTopic', 'page_templates_theme');");
                i++;
            }

            // Show web part tab
            if (showDesign || (PageTemplate.PageTemplateType == PageTemplateTypeEnum.AspxPortal))
            {
                // Web parts tab
                if ((!isDialog || SettingsKeyProvider.DevelopmentMode) && CurrentUser.IsGlobalAdministrator)
                {
                    SetTab(i, GetString("Administration-PageTemplate_Header.WebParts"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_WebParts.aspx?templateid=" + PageTemplateID + dialog), "SetHelpTopic('helpTopic', 'web_parts');");
                    i++;

                    if (ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CMSShowTemplateASPXTab"], false))
                    {
                        // ASPX tab
                        SetTab(i, GetString("Administration-PageTemplate_Header.ASPX"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_ASPX.aspx?templateid=" + PageTemplateID), "SetHelpTopic('helpTopic', 'page_templates_aspx_code');");
                        i++;
                    }
                }
            }

            if (PageTemplate.PageTemplateType != PageTemplateTypeEnum.Dashboard)
            {
                // Header tab
                SetTab(i, GetString("Administration-PageTemplate_Header.Header"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_HeaderTab.aspx?templateid=" + PageTemplateID + dialog), "SetHelpTopic('helpTopic', 'header');");
                i++;

                // Documents tab
                SetTab(i, GetString("general.documents"), URLHelper.ResolveUrl("~/CMSModules/PortalEngine/UI/PageTemplates/PageTemplate_Documents.aspx?templateid=" + PageTemplateID + dialog), "SetHelpTopic('helpTopic', 'page_templates_documents');");
                i++;
            }
        }
    }
Пример #5
0
    /// <summary>
    /// Groups created event handler.
    /// </summary>
    protected void ucUIToolbar_OnGroupsCreated(object sender, List <Group> groups)
    {
        // Try handle culture menu for page not found caused by untranslated document
        if (IsPageNotFound)
        {
            PageInfo pi = DocumentContext.CurrentCultureInvariantPageInfo;
            if ((pi != null) && (pi.NodeID != 0))
            {
                ReplaceCultureButton(groups);
            }
        }
        // Do not process groups for page not found
        else
        {
            // Show "Save" button only when the current page contains an editor widget zone.
            Group widgetsCategory = groups.Find(g => g.CssClass.Contains("OnSiteWidgetsCategory"));
            if ((widgetsCategory != null) &&
                (PortalManager.PageTemplate != null) && (PortalManager.PageTemplate.TemplateInstance != null) && (PortalManager.PageTemplate.TemplateInstance.WebPartZones != null))
            {
                bool showSaveButton = false;
                foreach (var zoneInstance in PortalManager.PageTemplate.TemplateInstance.WebPartZones)
                {
                    if (zoneInstance.WidgetZoneType == WidgetZoneTypeEnum.Editor)
                    {
                        showSaveButton = true;
                        break;
                    }
                }

                if (!showSaveButton)
                {
                    // No editor widget zones found => remove Save button
                    groups.Remove(widgetsCategory);
                }
            }

            ReplaceCultureButton(groups);

            // Replace Device profile button
            Group deviceProfile = groups.Find(g => g.CssClass.Contains("OnSiteDeviceProfile"));
            if (deviceProfile != null)
            {
                // Hide device profile selector when there is only one device defined or device profile module is disabled or license is not sufficient
                if (!DeviceProfileInfoProvider.IsDeviceProfilesEnabled(SiteContext.CurrentSiteName) || !LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.DeviceProfiles))
                {
                    // Remove the device profile button
                    groups.Remove(deviceProfile);
                }
                else
                {
                    deviceProfile.ControlPath = "~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx";
                }
            }

            // Replace the Highlight and Hidden buttons
            Group otherGroup = groups.Find(g => g.CssClass.Contains("OnSiteOthers"));
            if (otherGroup != null)
            {
                otherGroup.ControlPath = "~/CMSAdminControls/UI/UniMenu/OnSiteEdit/OtherMenu.ascx";
            }

            Group adminsGroup = groups.Find(g => g.CssClass.Contains("OnSiteAdmins"));
            if (adminsGroup != null)
            {
                adminsGroup.CssClass += " BigCMSDeskButton";
            }
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Initialize menu
        DataSet siteCulturesDS = CultureInfoProvider.GetSiteCultures(CMSContext.CurrentSiteName);

        Group content = new Group
        {
            Caption     = GetString("ContentMenu.ContentManagement"),
            ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/ContentMenu.ascx",
            CssClass    = "ContentMenuGroup"
        };

        contentMenu.Groups.Add(content);

        CMSUserControl modeMenu = Page.LoadUserControl("~/CMSAdminControls/UI/UniMenu/Content/ModeMenu.ascx") as CMSUserControl;

        if (modeMenu != null)
        {
            modeMenu.ID = "grpMode";
            modeMenu.SetValue("SelectedMode", SelectedMode);
            Group view = new Group
            {
                Caption  = GetString("ContentMenu.ViewMode"),
                Control  = modeMenu,
                CssClass = "ContentMenuGroup"
            };
            contentMenu.Groups.Add(view);
        }

        if (DeviceProfileInfoProvider.IsDeviceProfilesEnabled(CMSContext.CurrentSiteName))
        {
            CMSUserControl devicesMenu = Page.LoadUserControl("~/CMSModules/DeviceProfile/Controls/ProfilesMenuControl.ascx") as CMSUserControl;
            if (devicesMenu != null)
            {
                devicesMenu.ID = "grpDevices";
                devicesMenu.SetValue("SelectedDevice", SelectedDevice);
                Group view = new Group
                {
                    Caption  = GetString("ContentMenu.Device"),
                    Control  = devicesMenu,
                    CssClass = "ContentMenuGroup"
                };
                contentMenu.Groups.Add(view);
            }
        }

        // Do not display language menu
        if (!DataHelper.DataSourceIsEmpty(siteCulturesDS) && (siteCulturesDS.Tables[0].Rows.Count > 1))
        {
            CMSUserControl langMenu = Page.LoadUserControl("~/CMSModules/Content/Controls/LanguageMenu.ascx") as CMSUserControl;
            if (langMenu != null)
            {
                langMenu.ID = "grpLang";
                langMenu.SetValue("SelectedCulture", SelectedCulture);
                Group lang = new Group
                {
                    Control  = langMenu,
                    Caption  = GetString("contentmenu.language"),
                    CssClass = "ContentMenuGroup"
                };
                contentMenu.Groups.Add(lang);
            }
        }

        Group other = new Group
        {
            Caption     = GetString("contentmenu.other"),
            ControlPath = "~/CMSAdminControls/UI/UniMenu/Content/OtherMenu.ascx",
            CssClass    = "ContentMenuGroup"
        };

        contentMenu.Groups.Add(other);
    }