Beispiel #1
0
    /// <summary>
    /// Initializes this layout binding control.
    /// </summary>
    private void Initialize()
    {
        // Initialize source layout controls
        ltrSourceLayoutIcon.Text          = PortalHelper.GetIconHtml(SourceLayout.LayoutThumbnailGUID, ValidationHelper.GetString(SourceLayout.LayoutIconClass, PortalHelper.DefaultPageLayoutIconClass));
        SourceLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(SourceLayout.LayoutDisplayName));

        // Initialize target layout controls
        TargetLayout = DeviceProfileLayoutInfoProvider.GetTargetLayoutInfo(DeviceProfile, SourceLayout);
        if (TargetLayout != null)
        {
            ltrTargetLayoutIcon.Text          = PortalHelper.GetIconHtml(TargetLayout.LayoutThumbnailGUID, ValidationHelper.GetString(TargetLayout.LayoutIconClass, PortalHelper.DefaultPageLayoutIconClass));
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(TargetLayout.LayoutDisplayName));
        }
        else
        {
            ltrTargetLayoutIcon.Text          = PortalHelper.GetIconHtml(Guid.Empty, "icon-question-circle empty-device-layout-mapping");
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(GetString("device_profile.layoutmapping.sethint"));
        }

        // Initialize script to open target layout selection dialog
        string baseUrl = URLHelper.ResolveUrl("~/CMSModules/DeviceProfiles/Pages/SelectLayout.aspx");
        string url     = String.Format("{0}?deviceProfileId={1:D}&sourceLayoutId={2:D}&targetLayoutId={3:D}", baseUrl, DeviceProfile.ProfileID, SourceLayout.LayoutId, TargetLayout != null ? TargetLayout.LayoutId : 0);
        string script  = String.Format("modalDialog('{0}', 'SelectLayout', '1000', '785', null)", URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)));

        TargetLayoutItemControl.Attributes.Add("onclick", script);

        btnDelete.ToolTip       = GetString("device_profile.layoutmapping.unset");
        btnDelete.OnClientClick = "$cmsj.Event(event).stopPropagation(); Client_UnsetTargetLayout({sourceLayoutId:" + SourceLayout.LayoutId.ToString("D") + "}); return false;";
    }
    private void Initialize()
    {
        // Initialize source layout controls
        SourceLayoutThumbnail.AlternateText = HTMLHelper.HTMLEncode(GetString("device_profile.layoutmapping.sourcelayoutthumbalt"));
        SourceLayoutThumbnail.ImageUrl      = GetLayoutThumbnailUrl(SourceLayout);
        SourceLayoutDisplayNameLabel.Text   = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(SourceLayout.LayoutDisplayName));

        // Initialize target layout controls
        TargetLayoutThumbnail.AlternateText = HTMLHelper.HTMLEncode(GetString("device_profile.layoutmapping.targetlayoutthumbalt"));
        TargetLayout = DeviceProfileLayoutInfoProvider.GetTargetLayoutInfo(DeviceProfile, SourceLayout);
        if (TargetLayout != null)
        {
            TargetLayoutThumbnail.ImageUrl    = GetLayoutThumbnailUrl(TargetLayout);
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(TargetLayout.LayoutDisplayName));
        }
        else
        {
            TargetLayoutThumbnail.ImageUrl    = GetImageUrl("CMSModules/CMS_DeviceProfile/no_target_layout.png");
            TargetLayoutDisplayNameLabel.Text = HTMLHelper.HTMLEncode(GetString("device_profile.layoutmapping.sethint"));
        }

        // Initialize script to open target layout selection dialog
        string baseUrl = URLHelper.ResolveUrl("~/CMSModules/DeviceProfile/Pages/SelectLayout.aspx");
        string url     = String.Format("{0}?deviceProfileId={1:D}&sourceLayoutId={2:D}&targetLayoutId={3:D}", baseUrl, DeviceProfile.ProfileID, SourceLayout.LayoutId, TargetLayout != null ? TargetLayout.LayoutId : 0);
        string script  = String.Format("modalDialog('{0}', 'SelectLayout', '1000', '785', null)", URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)));

        TargetLayoutItemControl.Attributes.Add("onclick", script);
    }
Beispiel #3
0
    /// <summary>
    // Shows warning for not mapped device profiles
    /// </summary>
    private void SetDeviceWarning()
    {
        if (CurrentDeviceProfile != null)
        {
            PageTemplateDeviceLayoutInfo deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(TemplateID, CurrentDeviceProfile.ProfileID);
            bool layoutIsMapped = (deviceLayout != null);

            // Check layout auto mapping
            if (!layoutIsMapped && (TemplateID > 0) && (PageTemplateInfo != null))
            {
                layoutIsMapped |= (DeviceProfileLayoutInfoProvider.GetTargetLayoutInfo(CurrentDeviceProfile.ProfileID, PageTemplateInfo.LayoutID) != null);
            }

            // Device layout not defined
            if (!layoutIsMapped)
            {
                ShowWarning(GetString("devicelayout.notdefined"));
            }
        }
    }
    /// <summary>
    /// Gets the title text.
    /// </summary>
    private string GetTitleInformation()
    {
        if (deviceProfile != null)
        {
            PageTemplateDeviceLayoutInfo deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(templateId, deviceProfile.ProfileID);
            bool layoutIsMapped = (deviceLayout != null);

            // Check layout auto mapping
            if (!layoutIsMapped && (templateId > 0))
            {
                layoutIsMapped |= (DeviceProfileLayoutInfoProvider.GetTargetLayoutInfo(deviceProfile.ProfileID, pti.LayoutID) != null);
            }

            if (!layoutIsMapped)
            {
                // Device layout not defined
                return(GetString("devicelayout.notdefined"));
            }
        }

        return(null);
    }