/// <summary> /// Executes the UnsetTragetLayout client action using parameters passed in hidden fields. /// </summary> private void UnsetTargetLayout() { int sourceLayoutId = ValidationHelper.GetInteger(SourceLayoutIdentifierHiddenField.Value, 0); using (var scope = new CMSTransactionScope()) { LayoutInfo sourceLayout = LayoutInfoProvider.GetLayoutInfo(sourceLayoutId); if (sourceLayout == null) { throw new ApplicationException(GetString("device_profile.layoutmapping.errors.nosourcelayout")); } InfoObjectCollection <DeviceProfileLayoutInfo> bindings = DeviceProfileLayoutInfoProvider.GetDeviceProfileLayouts() .WhereEquals("DeviceProfileID", DeviceProfile.ProfileID) .WhereEquals("SourceLayoutID", sourceLayout.LayoutId) .TypedResult .Items; if (bindings.Count > 0) { DeviceProfileLayoutInfoProvider.DeleteDeviceProfileLayoutInfo(bindings[0]); } scope.Commit(); } }
/// <summary> /// Radio button changed. /// </summary> protected void radShared_CheckedChanged(object sender, EventArgs e) { if (radCustom.Checked) { txtCustom.ReadOnly = false; txtCustomCSS.ReadOnly = false; drpType.Enabled = true; selectShared.Enabled = false; } else { drpType.Enabled = false; txtCustom.ReadOnly = true; txtCustomCSS.ReadOnly = true; selectShared.Enabled = true; LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(ValidationHelper.GetInteger(selectShared.Value, 0)); if (li != null) { txtCustom.Text = li.LayoutCode; txtCustomCSS.Text = li.LayoutCSS; } } }
/// <summary> /// Gets the edited object. /// </summary> private object GetEditedObject() { object editedObject = null; if (PageTemplate != null) { int newSharedLayoutId = QueryHelper.GetInteger("newshared", -1); int oldSharedLayoutId = QueryHelper.GetInteger("oldshared", -1); // Default state - no radio buttons used if ((newSharedLayoutId == -1) && (oldSharedLayoutId == -1)) { editedObject = PageTemplate; } else { // If new shared layout is set, than it should be used as edited object // This happens when switched from custom to a shared layout if (newSharedLayoutId > 0) { // Standard page layout editedObject = LayoutInfoProvider.GetLayoutInfo(newSharedLayoutId); } // This means user switched from shared layout to custom else { var layout = LayoutInfoProvider.GetLayoutInfo(oldSharedLayoutId); // We have to work with the clone, because we need to change the data of the object // (copy from shared layout) var pageTemplateClone = PageTemplate.Clone(); if (layout != null) { // Delete the shared layout pageTemplateClone.LayoutID = 0; // Copy values pageTemplateClone.PageTemplateLayout = layout.LayoutCode; pageTemplateClone.PageTemplateCSS = layout.LayoutCSS; pageTemplateClone.PageTemplateLayoutType = layout.LayoutType; } editedObject = pageTemplateClone; } } } // Load the layout object else { var layoutId = QueryHelper.GetInteger("layoutid", 0); if (layoutId > 0) { editedObject = LayoutInfoProvider.GetLayoutInfo(layoutId); } } return(editedObject); }
private string LayoutSelector_OnItemSelected(string value) { int targetLayoutId = ValidationHelper.GetInteger(value, 0); TargetLayout = LayoutInfoProvider.GetLayoutInfo(targetLayoutId); return(ExecuteFunction(() => GetTargetLayoutDescription())); }
/// <summary> /// Creates a new instance of control that displays layout mapping for the specified layout, and returns it. /// </summary> /// <param name="sourceLayoutId">An identifier of the source layout.</param> /// <returns>A new instance of control that displays layout mapping for the specified layout.</returns> private CMSModules_DeviceProfiles_Controls_LayoutBinding CreateLayoutBindingControl(int sourceLayoutId) { CMSModules_DeviceProfiles_Controls_LayoutBinding control = LoadControl("~/CMSModules/DeviceProfiles/Controls/LayoutBinding.ascx") as CMSModules_DeviceProfiles_Controls_LayoutBinding; control.SourceLayout = LayoutInfoProvider.GetLayoutInfo(sourceLayoutId); control.DeviceProfile = DeviceProfile; return(control); }
/// <summary> /// Deletes layout. Called when the "Delete layout" button is pressed. /// Expects the CreateLayout method to be run first. /// </summary> private bool DeleteLayout() { // Get the layout LayoutInfo deleteLayout = LayoutInfoProvider.GetLayoutInfo("MyNewLayout"); // Delete the layout LayoutInfoProvider.DeleteLayoutInfo(deleteLayout); return(deleteLayout != null); }
protected override void OnPreInit(EventArgs e) { dialogMode = QueryHelper.GetBoolean("editonlycode", false); layoutId = QueryHelper.GetInteger("layoutid", 0); templateId = QueryHelper.GetInteger("templateid", 0); if (dialogMode) { MasterPageFile = "~/CMSMasterPages/UI/Dialogs/TabsHeader.master"; } else { CheckAccessToSiteManager(); } CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.Title.HelpTopicName = "CMS_Design_page_layout"; if (templateId > 0) { CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Layout/object.png"); CurrentMaster.Title.TitleText = GetString("pagetemplate.layoutproperties"); } else { CurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Layout/object.png"); CurrentMaster.Title.TitleText = GetString("administration-pagelayout_new.editlayout"); } if (templateId > 0) { var template = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); if (template.LayoutID > 0) { layoutId = template.LayoutID; } else { EditedObject = template; displayName = template.DisplayName; themePath = template.GetThemePath(); } } if (layoutId > 0) { var layout = LayoutInfoProvider.GetLayoutInfo(layoutId); EditedObject = layout; displayName = layout.LayoutDisplayName; themePath = layout.GetThemePath(); } base.OnPreInit(e); }
/// <summary> /// DropDownlist change. /// </summary> protected void selectShared_Changed(object sender, EventArgs ea) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(ValidationHelper.GetInteger(selectShared.Value, 0)); if (li != null) { txtCustom.Text = li.LayoutCode; txtCustom.ReadOnly = true; txtCustomCSS.Text = li.LayoutCSS; txtCustomCSS.ReadOnly = true; } }
/// <summary> /// Gets and updates layout. Called when the "Get and update layout" button is pressed. /// Expects the CreateLayout method to be run first. /// </summary> private bool GetAndUpdateLayout() { // Get the layout LayoutInfo updateLayout = LayoutInfoProvider.GetLayoutInfo("MyNewLayout"); if (updateLayout != null) { // Update the properties updateLayout.LayoutDisplayName = updateLayout.LayoutDisplayName.ToLower(); // Save the changes LayoutInfoProvider.SetLayoutInfo(updateLayout); return(true); } return(false); }
/// <summary> /// Retrieves the stylesheets of the layout from the database. /// </summary> /// <param name="layoutName">Layout name</param> /// <returns>The stylesheet data (plain version only)</returns> private static CMSOutputResource GetLayout(string layoutName) { LayoutInfo layoutInfo = LayoutInfoProvider.GetLayoutInfo(layoutName); if (layoutInfo == null) { return(null); } // Build the result CMSOutputResource resource = new CMSOutputResource() { Data = HTMLHelper.ResolveCSSUrls(layoutInfo.LayoutCSS, URLHelper.ApplicationPath), LastModified = layoutInfo.LayoutLastModified, Etag = layoutInfo.LayoutVersionGUID }; return(resource); }
/// <summary> /// Executes the SetTragetLayout client action using parameters passed in hidden fields. /// </summary> private void SetTargetLayout() { int sourceLayoutId = ValidationHelper.GetInteger(SourceLayoutIdentifierHiddenField.Value, 0); int targetLayoutId = ValidationHelper.GetInteger(TargetLayoutIdentifierHiddenField.Value, 0); using (var scope = new CMSTransactionScope()) { LayoutInfo sourceLayout = LayoutInfoProvider.GetLayoutInfo(sourceLayoutId); if (sourceLayout == null) { throw new ApplicationException(GetString("device_profile.layoutmapping.errors.nosourcelayout")); } LayoutInfo targetLayout = LayoutInfoProvider.GetLayoutInfo(targetLayoutId); if (targetLayout == null) { throw new ApplicationException(GetString("device_profile.layoutmapping.errors.notargetlayout")); } InfoObjectCollection <DeviceProfileLayoutInfo> bindings = DeviceProfileLayoutInfoProvider.GetDeviceProfileLayouts() .Where("DeviceProfileID", QueryOperator.Equals, DeviceProfile.ProfileID) .Where("SourceLayoutID", QueryOperator.Equals, sourceLayout.LayoutId) .TypedResult .Items; DeviceProfileLayoutInfo binding = null; if (bindings.Count > 0) { binding = bindings[0]; } else { binding = new DeviceProfileLayoutInfo { DeviceProfileID = DeviceProfile.ProfileID, SourceLayoutID = sourceLayout.LayoutId }; } binding.TargetLayoutID = targetLayout.LayoutId; DeviceProfileLayoutInfoProvider.SetDeviceProfileLayoutInfo(binding); scope.Commit(); } }
/// <summary> /// Executes the UnsetTragetLayout client action using parameters passed in hidden fields. /// </summary> private void UnsetTargetLayout() { int sourceLayoutId = ValidationHelper.GetInteger(SourceLayoutIdentifierHiddenField.Value, 0); using (CMSTransactionScope scope = new CMSTransactionScope()) { LayoutInfo sourceLayout = LayoutInfoProvider.GetLayoutInfo(sourceLayoutId); if (sourceLayout == null) { throw new ApplicationException(GetString("device_profile.layoutmapping.errors.nosourcelayout")); } string condition = String.Format("DeviceProfileID = {0:D} AND SourceLayoutID = {1:D}", DeviceProfile.ProfileID, sourceLayout.LayoutId); InfoObjectCollection <DeviceProfileLayoutInfo> bindings = DeviceProfileLayoutInfoProvider.GetDeviceProfileLayouts(condition, null).Items; if (bindings.Count > 0) { DeviceProfileLayoutInfoProvider.DeleteDeviceProfileLayoutInfo(bindings[0]); } scope.Commit(); } }
protected void Page_Load(object sender, EventArgs e) { // Setup the filesystem browser int layoutId = QueryHelper.GetInteger("layoutid", 0); if (layoutId > 0) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(layoutId); EditedObject = li; if (li != null) { // Ensure the theme folder themeElem.Path = "~/App_Themes/Components/Layouts/" + ValidationHelper.GetSafeFileName(li.LayoutCodeName); } } else { EditedObject = null; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Setup the filesystem browser int layoutId = QueryHelper.GetInteger("layoutid", 0); if (layoutId > 0) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(layoutId); EditedObject = li; if (li != null) { // Ensure the theme folder themeElem.Path = li.GetThemePath(); } } else { EditedObject = null; } }
protected void Page_Load(object sender, EventArgs e) { // Use UI culture for strings string culture = MembershipContext.AuthenticatedUser.PreferredUICultureCode; // Register dialog script ScriptHelper.RegisterDialogScript(Page); // Prepare script to display versions dialog StringBuilder script = new StringBuilder(); script.Append( @" function ShowVersionsDialog(objectType, objectId, objectName) { modalDialog('", ResolveUrl("~/CMSModules/Objects/Dialogs/ObjectVersionDialog.aspx"), @"' + '?objecttype=' + objectType + '&objectid=' + objectId + '&objectname=' + objectName,'VersionsDialog','800','600'); }" ); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowVersionDialog", ScriptHelper.GetScript(script.ToString())); // Check if template is ASPX one and initialize PageTemplateInfo variable bool isAspx = false; PageTemplateInfo pti = null; if (mPagePlaceholder != null) { pi = mPagePlaceholder.PageInfo; } if (pi != null) { pti = pi.UsedPageTemplateInfo; if (pti != null) { isAspx = pti.IsAspx; } } bool documentExists = ((pi != null) && (pi.DocumentID > 0)); if ((mPagePlaceholder != null) && (mPagePlaceholder.ViewMode == ViewModeEnum.DesignDisabled)) { // Hide edit layout and edit template if design mode is disabled iLayout.Visible = false; iTemplate.Visible = false; } else { if ((mPagePlaceholder != null) && (mPagePlaceholder.LayoutTemplate == null)) { // Edit layout iLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayout", culture); iLayout.Attributes.Add("onclick", "EditLayout();"); if ((pti != null) && (pti.LayoutID > 0)) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); // Display layout versions sub-menu if ((li != null) && ObjectVersionManager.DisplayVersionsTab(li)) { menuLayout.Visible = true; iLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayoutMore", culture); lblSharedLayoutVersions.Text = ResHelper.GetString("PlaceholderMenu.SharedLayoutVersions", culture); pnlSharedLayout.Attributes.Add("onclick", GetVersionsDialog(li.TypeInfo.ObjectType, li.LayoutId)); } } } else { iLayout.Visible = false; } if (documentExists) { // Template properties iTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplate", culture); int templateID = (pti != null) ? pti.PageTemplateId : 0; String aliasPath = (pi != null) ? pi.NodeAliasPath : ""; String url = ApplicationUrlHelper.GetElementDialogUrl("cms.design", "PageTemplate.EditPageTemplate", templateID, String.Format("aliaspath={0}", aliasPath)); iTemplate.Attributes.Add("onclick", String.Format("modalDialog('{0}', 'edittemplate', '95%', '95%');", url)); if (pti != null) { // Display template versions sub-menu if (ObjectVersionManager.DisplayVersionsTab(pti)) { menuTemplate.Visible = true; iTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplateMore", culture); lblTemplateVersions.Text = ResHelper.GetString("PlaceholderMenu.TemplateVersions", culture); pnlTemplateVersions.Attributes.Add("onclick", GetVersionsDialog(pti.TypeInfo.ObjectType, pti.PageTemplateId)); } } } } if (pti != null) { if ((!isAspx) && documentExists && pti.IsReusable) { if (!SynchronizationHelper.UseCheckinCheckout || CurrentPageInfo.UsedPageTemplateInfo.Generalized.IsCheckedOutByUser(MembershipContext.AuthenticatedUser)) { iClone.Text = ResHelper.GetString("PlaceholderMenu.IconClone", culture); iClone.OnClientClick = "CloneTemplate(GetContextMenuParameter('pagePlaceholderMenu'));"; } } else { iSaveAsNew.Text = ResHelper.GetString("PageProperties.Save", culture); int templateId = pi.UsedPageTemplateInfo.PageTemplateId; iSaveAsNew.OnClientClick = String.Format( "modalDialog('{0}?refresh=1&templateId={1}&siteid={2}', 'SaveNewTemplate', 720, 430); return false;", ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx"), templateId, SiteContext.CurrentSiteID); } } iRefresh.Text = ResHelper.GetString("PlaceholderMenu.IconRefresh", culture); iRefresh.Attributes.Add("onclick", "RefreshPage();"); }
/// <summary> /// Handles the OnAfterAction event of the ObjectManager control. /// </summary> protected void ObjectManager_OnAfterAction(object sender, SimpleObjectManagerEventArgs e) { if ((e.ActionName == ComponentEvents.SAVE) || (e.ActionName == ComponentEvents.CHECKIN)) { if (EditForm.ValidateData()) { LayoutInfo li = EditedObject as LayoutInfo; if (radShared.Checked) { // Get the current layout type PageTemplateLayoutTypeEnum layoutType = PageTemplateLayoutTypeEnum.PageTemplateLayout; PageTemplateDeviceLayoutInfoProvider.GetLayoutObject(PageTemplateInfo, DeviceProfileInfo, out layoutType); switch (layoutType) { case PageTemplateLayoutTypeEnum.PageTemplateLayout: case PageTemplateLayoutTypeEnum.SharedLayout: { int newLayoutId = ValidationHelper.GetInteger(drpLayout.Value, 0); // We need to save also page template if shared template is used if ((PageTemplateInfo != null) && (PageTemplateInfo.LayoutID != li.LayoutId)) { PageTemplateInfo.LayoutID = newLayoutId; PageTemplateInfo.Update(); } } break; case PageTemplateLayoutTypeEnum.DeviceSharedLayout: case PageTemplateLayoutTypeEnum.DeviceLayout: { // We need to save also template device layout if shared template is used PageTemplateDeviceLayoutInfo deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(TemplateID, DeviceProfileID); if (deviceLayout != null) { deviceLayout.LayoutID = ValidationHelper.GetInteger(drpLayout.Value, 0); deviceLayout.LayoutCode = null; deviceLayout.LayoutCSS = null; deviceLayout.Update(); } } break; default: break; } } // Register refresh script string refreshScript = ScriptHelper.GetScript("if ((wopener != null) && (wopener.RefreshPage != null)) {wopener.RefreshPage();}"); ScriptHelper.RegisterClientScriptBlock(Page, typeof(String), "pageTemplateRefreshScript", refreshScript); // Register preview refresh RegisterRefreshScript(); // Close if required if (ValidationHelper.GetBoolean(hdnClose.Value, false)) { ScriptHelper.RegisterStartupScript(Page, typeof(string), "CloseDialogPreviewScript", ScriptHelper.GetScript("CloseDialog();")); } // Load actual layout info (it was edited during saving by LayoutInfoProvider) if (li != null) { actualLayoutInfo = LayoutInfoProvider.GetLayoutInfo(li.LayoutId); } } // Hide warning after save MessagesPlaceHolder.WarningText = ""; } else if (e.ActionName == ComponentEvents.UNDO_CHECKOUT) { if (AllowTypeSwitching) { var url = RequestContext.CurrentURL; url = URLHelper.RemoveParameterFromUrl(url, "newshared"); url = URLHelper.RemoveParameterFromUrl(url, "oldshared"); url = URLHelper.AddParameterToUrl(url, "wopenerrefresh", "1"); Response.Redirect(url); } } else if (e.ActionName == ComponentEvents.CHECKOUT) { DisplayMessage(true); } switch (e.ActionName) { case ComponentEvents.SAVE: case ComponentEvents.CHECKOUT: case ComponentEvents.CHECKIN: case ComponentEvents.UNDO_CHECKOUT: if (DialogMode) { RegisterWOpenerRefreshScript(); } else if (dialog) { ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "parentWOpenerRefresh", ScriptHelper.GetScript("if (parent && parent.wopener && parent.wopener.refresh) { parent.wopener.refresh(); }")); } break; } if (!AllowTypeSwitching && (EditedObjectType == EditedObjectTypeEnum.Layout) && (e.ActionName != ComponentEvents.CHECKOUT) && !DialogMode) { ScriptHelper.RefreshTabHeader(Page, EditForm.EditedObject.Generalized.ObjectDisplayName); } // No save for checkout if (e.ActionName != ComponentEvents.CHECKOUT) { ShowChangesSaved(); } }
/// <summary> /// Ensures the template from the selection and returns the template ID. /// </summary> /// <param name="documentName">Document name for the ad-hoc template</param> /// <param name="errorMessage">Returns the error message</param> public int EnsureTemplate(string documentName, ref string errorMessage) { int result = 0; // Template selection if (radUseTemplate.Checked) { // Template page int templateId = ValidationHelper.GetInteger(templateSelector.SelectedItem, 0); if (templateId > 0) { result = templateId; } else { errorMessage = GetString("NewPage.TemplateError"); } } else if (radInherit.Checked) { // Inherited page } else if (radCreateBlank.Checked || radCreateEmpty.Checked) { // Create custom template info for the page PageTemplateInfo templateInfo = new PageTemplateInfo(true); // Prepare ad-hoc template name string displayName = "Ad-hoc: " + documentName; if (radCreateBlank.Checked) { // Blank page with layout int layoutId = ValidationHelper.GetInteger(layoutSelector.SelectedItem, 0); if (layoutId > 0) { templateInfo.LayoutID = layoutId; // Copy layout to selected template if (chkLayoutPageTemplate.Checked) { templateInfo.LayoutID = 0; LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(layoutId); if (li != null) { templateInfo.PageTemplateLayout = li.LayoutCode; templateInfo.PageTemplateLayoutType = li.LayoutType; } else { errorMessage = GetString("NewPage.LayoutError"); } } } else { errorMessage = GetString("NewPage.LayoutError"); } } else if (radCreateEmpty.Checked) { // Empty template templateInfo.LayoutID = 0; templateInfo.PageTemplateLayout = "<cc1:CMSWebPartZone ID=\"zoneLeft\" runat=\"server\" />"; templateInfo.PageTemplateLayoutType = LayoutTypeEnum.Ascx; } if (String.IsNullOrEmpty(errorMessage)) { // Create ad-hoc template templateInfo = PageTemplateInfoProvider.CloneTemplateAsAdHoc(templateInfo, displayName, CMSContext.CurrentSiteID); // Set inherit only master templateInfo.InheritPageLevels = "\\"; PageTemplateInfoProvider.SetPageTemplateInfo(templateInfo); if (CMSContext.CurrentSite != null) { PageTemplateInfoProvider.AddPageTemplateToSite(templateInfo.PageTemplateId, CMSContext.CurrentSiteID); } // Assign the template to document result = templateInfo.PageTemplateId; } } // Reload the template selector in case of error if (!String.IsNullOrEmpty(errorMessage)) { if (radUseTemplate.Checked) { templateSelector.ReloadData(); } } return(result); }
/// <summary> /// Reload data. /// </summary> public void ReloadData() { if (templateId > 0) { PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); if (pti != null) { // For ASPX, do not allow to change the layout if (pti.PageTemplateType == PageTemplateTypeEnum.Aspx) { plcContent.Visible = false; pnlCheckOutInfo.Visible = false; lblAspxInfo.Visible = true; lblAspxInfo.Text = GetString("TemplateLayout.ASPXtemplate"); return; } this.pnlCheckOutInfo.Visible = true; if (pti.PageTemplateLayoutCheckedOutByUserID > 0) { this.txtCustom.ReadOnly = true; this.txtCustomCSS.ReadOnly = true; string username = null; UserInfo ui = UserInfoProvider.GetUserInfo(pti.PageTemplateLayoutCheckedOutByUserID); if (ui != null) { username = HTMLHelper.HTMLEncode(ui.FullName); } // Checked out by current machine if (pti.PageTemplateLayoutCheckedOutMachineName.ToLower() == HTTPHelper.MachineName.ToLower()) { this.lblCheckOutInfo.Text = String.Format(GetString("PageLayout.CheckedOut"), Server.MapPath(pti.PageTemplateLayoutCheckedOutFileName)); } else { this.lblCheckOutInfo.Text = String.Format(GetString("PageLayout.CheckedOutOnAnotherMachine"), pti.PageTemplateLayoutCheckedOutFileName, username); } } else { string url = null; if (pti.IsReusable) { url = Server.MapPath(PageTemplateInfoProvider.GetLayoutUrl(pti.CodeName, null, pti.PageTemplateLayoutType)); } else { url = Server.MapPath(PageTemplateInfoProvider.GetAdhocLayoutUrl(pti.CodeName, null, pti.PageTemplateLayoutType)); } this.lblCheckOutInfo.Text = String.Format(GetString("PageLayout.CheckOutInfo"), url); } if (ValidationHelper.GetInteger(pti.LayoutID, 0) > 0) { // Shared layout pnlCheckOutInfo.Visible = false; radShared.Checked = true; txtCustom.ReadOnly = true; txtCustomCSS.ReadOnly = true; drpType.Enabled = false; selectShared.Enabled = true; try { // Load layout content selectShared.Value = pti.LayoutID.ToString(); LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); if (li != null) { txtCustom.Text = li.LayoutCode; txtCustomCSS.Text = li.LayoutCSS; drpType.SelectedIndex = (li.LayoutType == LayoutTypeEnum.Html ? 1 : 0); } } catch { } } else { // Custom layout radCustom.Checked = true; txtCustom.Text = pti.PageTemplateLayout; txtCustom.ReadOnly = false; txtCustomCSS.Text = pti.PageTemplateCSS; txtCustomCSS.ReadOnly = false; drpType.SelectedIndex = (pti.PageTemplateLayoutType == LayoutTypeEnum.Html ? 1 : 0); drpType.Enabled = true; selectShared.Enabled = false; } } } }
/// <summary> /// Gets the edited object. /// </summary> private object GetEditedObject() { object editedObject = null; if (PageTemplate != null) { DeviceProfileInfo profileInfo = DeviceProfile; int newSharedLayoutId = QueryHelper.GetInteger("newshared", -1); int oldSharedLayoutId = QueryHelper.GetInteger("oldshared", -1); // Check modify shared templates permission if (PageTemplate.IsReusable && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Design", "Design.ModifySharedTemplates")) { RedirectToUIElementAccessDenied("CMS.Design", "Design.ModifySharedTemplates"); } // Default state - no radio buttons used if ((newSharedLayoutId == -1) && (oldSharedLayoutId == -1)) { editedObject = PageTemplateDeviceLayoutInfoProvider.GetLayoutObject(PageTemplate, profileInfo); } else { // If new shared layout is set, than it should be used as edited object // This happens when switched from custom to a shared layout if (newSharedLayoutId > 0) { // Standard page layout editedObject = LayoutInfoProvider.GetLayoutInfo(newSharedLayoutId); } else if (newSharedLayoutId == 0) { // This means user switched from shared layout to custom // Data has to be copied to PageTemplateInfo if (profileInfo != null) { // Get the current device layout if exists PageTemplateDeviceLayoutInfo deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(PageTemplate.PageTemplateId, profileInfo.ProfileID); if (deviceLayout != null) { // Custom device layout (use old layout) editedObject = PageTemplateDeviceLayoutInfoProvider.CloneInfoObject(deviceLayout, oldSharedLayoutId) as PageTemplateDeviceLayoutInfo; } } else { // We have to work with the clone, because we need to change the data of the object // (copy from shared layout) editedObject = PageTemplateDeviceLayoutInfoProvider.CloneInfoObject(PageTemplate, oldSharedLayoutId) as PageTemplateInfo; } } } } // Load the layout object else { var layoutId = QueryHelper.GetInteger("layoutid", 0); if (layoutId > 0) { editedObject = LayoutInfoProvider.GetLayoutInfo(layoutId); } } return(editedObject); }
protected void btnSave_Click(object sender, EventArgs e) { if ((nodeId > 0) && (node != null)) { LayoutTypeEnum layoutType = LayoutInfoProvider.GetLayoutTypeEnum(drpType.SelectedValue); // Check the permissions if ((layoutType != LayoutTypeEnum.Ascx) || user.IsAuthorizedPerResource("CMS.Design", "EditCode")) { // Update the layout if (node.DocumentPageTemplateID > 0) { PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(node.DocumentPageTemplateID); if (pti != null) { // Get shared layout LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); if (li != null) { // Update shared layout li.LayoutCode = txtLayout.Text; li.LayoutType = layoutType; LayoutInfoProvider.SetLayoutInfo(li); } else if (pti.PageTemplateLayoutCheckedOutByUserID <= 0) { // Update custom layout pti.PageTemplateLayout = txtLayout.Text; pti.PageTemplateLayoutType = layoutType; PageTemplateInfoProvider.SetPageTemplateInfo(pti); } } } } // Update fields node.NodeBodyElementAttributes = txtBodyCss.Text; node.NodeDocType = txtDocType.Text; node.NodeHeadTags = txtHeadTags.Value.ToString(); // Update the node node.Update(); // Update search index if ((node.PublishedVersionExists) && (SearchIndexInfoProvider.SearchEnabled)) { SearchTaskInfoProvider.CreateTask(SearchTaskTypeEnum.Update, PredefinedObjectType.DOCUMENT, SearchHelper.ID_FIELD, node.GetSearchID()); } // Log synchronization DocumentSynchronizationHelper.LogDocumentChange(node, TaskTypeEnum.UpdateDocument, tree); lblInfo.Visible = true; lblInfo.Text = GetString("General.ChangesSaved"); // Clear cache PageInfoProvider.RemoveAllPageInfosFromCache(); } }
/// <summary> /// Gets the edited object. /// </summary> /// <param name="templateId">The template id - if template/device layout is being edited</param> /// <param name="layoutId">The layout id - if shared layout is being edited</param> /// <param name="newSharedLayoutId">The new shared layout id - when changing shared layouts for template/device layouts</param> /// <param name="oldSharedLayoutId">The old shared layout id - when changing shared layouts for template/device layouts</param> /// <param name="deviceProfileId">The device profile id</param> private object GetEditedObject(int templateId, int layoutId, int newSharedLayoutId, int oldSharedLayoutId, int deviceProfileId) { object editedObject = null; if (templateId > 0) { PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); DeviceProfileInfo profileInfo = DeviceProfileInfoProvider.GetDeviceProfileInfo(deviceProfileId); PageTemplateLayoutTypeEnum type = PageTemplateLayoutTypeEnum.PageTemplateLayout; // Standard page template layout if (pti != null) { // Check modify shared templates permission if (pti.IsReusable && !CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Content", "Design.ModifySharedTemplates")) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.ModifySharedTemplates"); } // Default state - no radio buttons used if ((newSharedLayoutId == -1) && (oldSharedLayoutId == -1)) { editedObject = PageTemplateDeviceLayoutInfoProvider.GetLayoutObject(pti, profileInfo, out type); } else { // If new shared layout is set, than it should be used as edited object // This happens when switched from custom to a shared layout if (newSharedLayoutId > 0) { // Standard page layout editedObject = LayoutInfoProvider.GetLayoutInfo(newSharedLayoutId); } else if (newSharedLayoutId == 0) { // This means user switched from shared layout to custom // Data has to be copied to PageTemplateInfo PageTemplateDeviceLayoutInfo deviceLayout = null; if (deviceProfileId > 0) { // Get the current device layout if exists deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(templateId, deviceProfileId); if (deviceLayout != null) { // Custom device layout (use old layout) editedObject = PageTemplateDeviceLayoutInfoProvider.CloneInfoObject(deviceLayout, oldSharedLayoutId) as PageTemplateDeviceLayoutInfo; } } else { // We have to work with the clone, because we need to change the data of the object // (copy from shared layout) editedObject = PageTemplateDeviceLayoutInfoProvider.CloneInfoObject(pti, oldSharedLayoutId) as PageTemplateInfo; } } } } } else { // Load the object if (layoutId > 0) { editedObject = LayoutInfoProvider.GetLayoutInfo(layoutId); } } return(editedObject); }
public void LoadData() { if (nodeId > 0) { // Get the document tree = new TreeProvider(user); node = tree.SelectSingleNode(nodeId, user.PreferredCultureCode); if (node != null) { PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(node.DocumentPageTemplateID); if (pti != null) { // Get shared layout LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); if (li != null) { // Load shared layout if (!RequestHelper.IsPostBack()) { txtLayout.Text = li.LayoutCode; drpType.SelectedIndex = (li.LayoutType == LayoutTypeEnum.Html ? 1 : 0); } if (li.LayoutCheckedOutByUserID > 0) { lblChecked.Visible = true; lblChecked.Text = "<br />" + AddSpaces(2) + GetString("MasterPage.LayoutCheckedOut"); if (!RequestHelper.IsPostBack()) { txtLayout.Text = li.LayoutCode; txtLayout.ReadOnly = true; } } } else { // Load custom layout if (!RequestHelper.IsPostBack()) { txtLayout.Text = ValidationHelper.GetString(pti.PageTemplateLayout, ""); drpType.SelectedIndex = (pti.PageTemplateLayoutType == LayoutTypeEnum.Html ? 1 : 0); } if (pti.PageTemplateLayoutCheckedOutByUserID > 0) { lblChecked.Visible = true; lblChecked.Text = "<br />" + AddSpaces(2) + GetString("MasterPage.LayoutCheckedOut"); if (!RequestHelper.IsPostBack()) { txtLayout.ReadOnly = true; } } } } else { txtLayout.ReadOnly = true; } // Load node data if (!RequestHelper.IsPostBack()) { txtBodyCss.Text = node.NodeBodyElementAttributes; txtDocType.Text = node.NodeDocType; txtHeadTags.Value = node.NodeHeadTags; } } } lblAfterDocType.Text = HighlightHTML("<html>") + "<br />" + AddSpaces(1) + HighlightHTML("<head>"); lblAfterHeadTags.Text = AddSpaces(1) + HighlightHTML("</head>"); lblAfterLayout.Text = AddSpaces(1) + HighlightHTML("</body>") + "<br />" + HighlightHTML("</html>"); lblBodyEnd.Text = HighlightHTML(">"); lblBodyStart.Text = AddSpaces(1) + HighlightHTML("<body " + HttpUtility.HtmlDecode(mBody)); }
/// <summary> /// Save button is clicked. /// </summary> protected void SaveAction(object sender, EventArgs e) { // Check permissions if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Design", "Design.EditLayout")) { RedirectToUIElementAccessDenied("CMS.Design", "Design.EditLayout"); } // New device profile int newDeviceProfileId = deviceProfileId; if (newDeviceProfileId == 0) { newDeviceProfileId = ValidationHelper.GetInteger(ucNewDeviceProfile.Value, 0); } if (newDeviceProfileId == 0) { // Show error - select device profile first ShowError(GetString("devicelayout.selectdeviceprofile.error")); rbtnDevice.Checked = true; return; } PageTemplateInfo pti = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); if ((pti != null) && (newDeviceProfileId > 0)) { string layoutCode = null; string layoutCSS = null; int layoutId = 0; LayoutTypeEnum layoutType = LayoutTypeEnum.Ascx; if (rbtnDevice.Checked) { // Copy from device int selectedDeviceProfileId = ValidationHelper.GetInteger(ucDeviceProfile.Value, 0); if (selectedDeviceProfileId > 0) { // Existing device profile PageTemplateDeviceLayoutInfo selectedDeviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(templateId, selectedDeviceProfileId); if (selectedDeviceLayout != null) { layoutId = selectedDeviceLayout.LayoutID; layoutCode = selectedDeviceLayout.LayoutCode; layoutCSS = selectedDeviceLayout.LayoutCSS; layoutType = selectedDeviceLayout.LayoutType; } } else { // Default device layoutType = pti.PageTemplateLayoutType; if (pti.LayoutID > 0) { layoutId = pti.LayoutID; } else { layoutCode = pti.PageTemplateLayout; layoutCSS = pti.PageTemplateCSS; } } } else if (rbtnLayout.Checked) { // Use existing layout int selectedLayoutId = ValidationHelper.GetInteger(ucLayout.Value, 0); LayoutInfo selectedLayout = LayoutInfoProvider.GetLayoutInfo(selectedLayoutId); if (selectedLayout != null) { layoutType = selectedLayout.LayoutType; if (chkCopy.Checked) { // Copy layout code layoutCode = selectedLayout.LayoutCode; layoutCSS = selectedLayout.LayoutCSS; } else { // Copy layout id layoutId = selectedLayoutId; } } } else if (rbtnEmptyLayout.Checked) { layoutCode = "<cms:CMSWebPartZone ZoneID=\"zoneA\" runat=\"server\" />"; } PageTemplateDeviceLayoutInfo deviceLayout = PageTemplateDeviceLayoutInfoProvider.GetTemplateDeviceLayoutInfo(templateId, newDeviceProfileId); if (deviceLayout == null) { // Create a new device profile layout object deviceLayout = new PageTemplateDeviceLayoutInfo(); deviceLayout.PageTemplateID = templateId; deviceLayout.ProfileID = newDeviceProfileId; } // Modify the device profile layout object with updated values deviceLayout.LayoutID = layoutId; deviceLayout.LayoutType = layoutType; deviceLayout.LayoutCode = layoutCode; deviceLayout.LayoutCSS = layoutCSS; // Save the device profile layout object PageTemplateDeviceLayoutInfoProvider.SetTemplateDeviceLayoutInfo(deviceLayout); UIContext.EditedObject = deviceLayout; CMSObjectManager.CheckOutNewObject(Page); // Register refresh page scripts ScriptHelper.RegisterStartupScript(this, typeof(string), "deviceLayoutSaved", "if (wopener) { wopener.location.replace(wopener.location); } CloseDialog();", true); } }
/// <summary> /// Ensures the template from the selection and returns the template ID. /// </summary> /// <param name="documentName">Document name for the ad-hoc template</param> /// <param name="nodeGuid">Owner node GUID in case of ad-hoc template</param> /// <param name="errorMessage">Returns the error message</param> public PageTemplateInfo EnsureTemplate(string documentName, Guid nodeGuid, ref string errorMessage) { bool cloneAsAdHoc = false; bool masterOnly = false; PageTemplateInfo templateInfo = null; // Template selection if (radUseTemplate.Checked) { // Template page int templateId = ValidationHelper.GetInteger(templateSelector.SelectedItem, 0); if (templateId > 0) { // Get the template and check if it should be cloned templateInfo = PageTemplateInfoProvider.GetPageTemplateInfo(templateId); if (templateInfo != null) { cloneAsAdHoc = templateInfo.PageTemplateCloneAsAdHoc; } } else { errorMessage = GetString("NewPage.TemplateError"); // Reload template selector to show correct subtree templateSelector.ResetToDefault(); } } else if (radInherit.Checked) { // Inherited page } else if (radCreateBlank.Checked || radCreateEmpty.Checked) { // Create custom template info for the page templateInfo = new PageTemplateInfo(); if (radCreateBlank.Checked) { // Blank page with layout int layoutId = ValidationHelper.GetInteger(layoutSelector.SelectedItem, 0); if (layoutId > 0) { templateInfo.LayoutID = layoutId; // Copy layout to selected template if (chkLayoutPageTemplate.Checked) { templateInfo.LayoutID = 0; LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(layoutId); if (li != null) { templateInfo.PageTemplateLayout = li.LayoutCode; templateInfo.PageTemplateLayoutType = li.LayoutType; } else { errorMessage = GetString("NewPage.LayoutError"); } } } else { errorMessage = GetString("NewPage.LayoutError"); } } else if (radCreateEmpty.Checked) { // Empty template templateInfo.LayoutID = 0; templateInfo.PageTemplateLayout = "<cms:CMSWebPartZone ZoneID=\"zoneA\" runat=\"server\" />"; templateInfo.PageTemplateLayoutType = LayoutTypeEnum.Ascx; } if (String.IsNullOrEmpty(errorMessage)) { cloneAsAdHoc = true; masterOnly = true; } } if (cloneAsAdHoc) { // Prepare ad-hoc template name string displayName = "Ad-hoc: " + documentName; // Create ad-hoc template templateInfo = PageTemplateInfoProvider.CloneTemplateAsAdHoc(templateInfo, displayName, SiteContext.CurrentSiteID, nodeGuid); // Set inherit only master if (masterOnly) { templateInfo.InheritPageLevels = "\\"; } PageTemplateInfoProvider.SetPageTemplateInfo(templateInfo); if (SiteContext.CurrentSite != null) { PageTemplateInfoProvider.AddPageTemplateToSite(templateInfo.PageTemplateId, SiteContext.CurrentSiteID); } CheckOutTemplate(templateInfo); } // Assign owner node GUID if ((templateInfo != null) && !templateInfo.IsReusable) { templateInfo.PageTemplateNodeGUID = nodeGuid; } // Reload the template selector in case of error if (!String.IsNullOrEmpty(errorMessage)) { if (radUseTemplate.Checked) { templateSelector.ReloadData(); } } return(templateInfo); }
protected void Page_Load(object sender, EventArgs e) { // Use UI culture for strings string culture = CMSContext.CurrentUser.PreferredUICultureCode; // Register dialog script ScriptHelper.RegisterDialogScript(Page); // Prepare script to display versions dialog StringBuilder script = new StringBuilder(); script.Append( @" function ShowVersionsDialog(objectType, objectId, objectName) { modalDialog('", ResolveUrl("~/CMSModules/Objects/Dialogs/ObjectVersionDialog.aspx"), @"' + '?objecttype=' + objectType + '&objectid=' + objectId + '&objectname=' + objectName,'VersionsDialog','800','600'); }" ); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowVersionDialog", ScriptHelper.GetScript(script.ToString())); // Check if template is ASPX one and initialize PageTemplateInfo variable bool isAspx = false; PageTemplateInfo pti = null; if (mPagePlaceholder != null) { pi = mPagePlaceholder.PageInfo; } if (pi != null) { pti = pi.UsedPageTemplateInfo; if (pti != null) { isAspx = pti.IsAspx; } } bool documentExists = ((pi != null) && (pi.DocumentID > 0)); if ((mPagePlaceholder != null) && (mPagePlaceholder.ViewMode == ViewModeEnum.DesignDisabled)) { // Hide edit layout and edit template if design mode is disabled iLayout.Visible = false; iTemplate.Visible = false; } else { // Wireframe options if (documentExists && PortalHelper.IsWireframingEnabled(CMSContext.CurrentSiteName)) { iSepWireframe.Visible = true; if (pi.NodeWireframeTemplateID <= 0) { // Create wireframe iWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/16/createwireframe.png"); iWireframe.Text = ResHelper.GetString("Wireframe.Create", culture); iWireframe.RedirectUrl = String.Format("~/CMSModules/Content/CMSDesk/Properties/CreateWireframe.aspx?nodeid={0}&culture={1}", pi.NodeID, pi.DocumentCulture); } else { // Remove wireframe iWireframe.ImageUrl = GetImageUrl("CMSModules/CMS_Content/EditMenu/16/removewireframe.png"); iWireframe.Text = ResHelper.GetString("Wireframe.Remove", culture); iWireframe.OnClientClick = "if (!confirm('" + GetString("Wireframe.ConfirmRemove") + "')) return false;"; iWireframe.Click += iWireframe_Click; } } if ((mPagePlaceholder != null) && (mPagePlaceholder.LayoutTemplate == null)) { // Edit layout iLayout.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Layout.png"); iLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayout", culture); iLayout.Attributes.Add("onclick", "EditLayout();"); if ((pti != null) && (pti.LayoutID > 0)) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); // Display layout versions sub-menu if ((li != null) && ObjectVersionManager.DisplayVersionsTab(li)) { menuLayout.Visible = true; iLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayoutMore", culture); lblSharedLayoutVersions.Text = ResHelper.GetString("PlaceholderMenu.SharedLayoutVersions", culture); pnlSharedLayout.Attributes.Add("onclick", GetVersionsDialog(li.ObjectType, li.LayoutId)); } } } else { iLayout.Visible = false; } if (documentExists) { // Template properties iTemplate.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Template.png"); iTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplate", culture); iTemplate.Attributes.Add("onclick", "EditTemplate(GetContextMenuParameter('pagePlaceholderMenu'));"); if (pti != null) { // Display template versions sub-menu if (ObjectVersionManager.DisplayVersionsTab(pti)) { menuTemplate.Visible = true; iTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplateMore", culture); lblTemplateVersions.Text = ResHelper.GetString("PlaceholderMenu.TemplateVersions", culture); pnlTemplateVersions.Attributes.Add("onclick", GetVersionsDialog(pti.ObjectType, pti.PageTemplateId)); } } } } if (pti != null) { if ((!isAspx) && documentExists && pti.IsReusable) { iClone.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Clonetemplate.png"); iClone.Text = ResHelper.GetString("PlaceholderMenu.IconClone", culture); iClone.OnClientClick = "CloneTemplate(GetContextMenuParameter('pagePlaceholderMenu'));"; } else { iSaveAsNew.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/saveasnew.png"); iSaveAsNew.Text = ResHelper.GetString("PageProperties.Save", culture); int templateId = pi.UsedPageTemplateInfo.PageTemplateId; iSaveAsNew.OnClientClick = String.Format( "modalDialog('{0}?refresh=1&templateId={1}&siteid={2}{3}', 'SaveNewTemplate', 600, 400); return false;", ResolveUrl("~/CMSModules/PortalEngine/UI/Layout/SaveNewPageTemplate.aspx"), templateId, CMSContext.CurrentSiteID, ((CMSContext.ViewMode == ViewModeEnum.Wireframe) ? "&assign=0" : "") ); } } iRefresh.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Refresh.png"); iRefresh.Text = ResHelper.GetString("PlaceholderMenu.IconRefresh", culture); iRefresh.Attributes.Add("onclick", "RefreshPage();"); }
protected void Page_Load(object sender, EventArgs e) { // Use UI culture for strings string culture = CMSContext.CurrentUser.PreferredUICultureCode; // Register dialog script ScriptHelper.RegisterDialogScript(Page); // Prepare script to display versions dialog StringBuilder script = new StringBuilder(); script.Append( @" function ShowVersionsDialog(objectType, objectId, objectName) { modalDialog('", ResolveUrl("~/CMSModules/Objects/Dialogs/ObjectVersionDialog.aspx"), @"' + '?objecttype=' + objectType + '&objectid=' + objectId + '&objectname=' + objectName,'VersionsDialog','800','600'); }" ); ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "ShowVersionDialog", ScriptHelper.GetScript(script.ToString())); // Check if template is ASPX one and initialize PageTemplateInfo variable bool isAspx = false; PageInfo pi = null; PageTemplateInfo pti = null; if (mPagePlaceholder != null) { pi = mPagePlaceholder.PageInfo; } if (pi != null) { pti = pi.PageTemplateInfo; if (pti != null) { isAspx = pti.IsAspx; } } if ((mPagePlaceholder != null) && (mPagePlaceholder.ViewMode == ViewModeEnum.DesignDisabled)) { // Hide edit layout and edit template if design mode is disabled this.pnlLayout.Visible = false; this.pnlTemplate.Visible = false; } else { if ((mPagePlaceholder != null) && (mPagePlaceholder.LayoutTemplate == null)) { // Edit layout this.imgLayout.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Layout.png"); this.lblLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayout", culture); this.imgLayout.AlternateText = this.lblLayout.Text; //this.lblLayout.ToolTip = GetString("WebPartMenu.Layout", culture); this.pnlLayout.Attributes.Add("onclick", "EditLayout();"); if ((pti != null) && (pti.LayoutID > 0)) { LayoutInfo li = LayoutInfoProvider.GetLayoutInfo(pti.LayoutID); // Display layout versions sub-menu if ((li != null) && ObjectVersionManager.DisplayVersionsTab(li)) { menuLayout.Visible = true; lblLayout.Text = ResHelper.GetString("PlaceholderMenu.IconLayoutMore", culture); lblSharedLayoutVersions.Text = ResHelper.GetString("PlaceholderMenu.SharedLayoutVersions", culture); pnlSharedLayout.Attributes.Add("onclick", GetVersionsDialog(li.ObjectType, li.LayoutId)); } } } else { this.pnlLayout.Visible = false; } // Template properties this.imgTemplate.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Template.png"); this.lblTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplate", culture); this.imgTemplate.AlternateText = this.lblTemplate.Text; //this.lblTemplate.ToolTip = GetString("WebPartMenu.Template", culture); this.pnlTemplate.Attributes.Add("onclick", "EditTemplate(GetContextMenuParameter('pagePlaceholderMenu'));"); if (pti != null) { // Display template versions sub-menu if (ObjectVersionManager.DisplayVersionsTab(pti)) { menuTemplate.Visible = true; lblTemplate.Text = ResHelper.GetString("PlaceholderMenu.IconTemplateMore", culture); lblTemplateVersions.Text = ResHelper.GetString("PlaceholderMenu.TemplateVersions", culture); pnlTemplateVersions.Attributes.Add("onclick", GetVersionsDialog(pti.ObjectType, pti.PageTemplateId)); } } } if (!isAspx) { this.imgClone.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Clonetemplate.png"); this.lblClone.Text = ResHelper.GetString("PlaceholderMenu.IconClone", culture); this.imgClone.AlternateText = this.lblClone.Text; //this.lblClone.ToolTip = GetString("WebPartMenu.Clone", culture); this.pnlClone.Attributes.Add("onclick", "CloneTemplate(GetContextMenuParameter('pagePlaceholderMenu'));"); } else { this.pnlClone.Visible = false; } this.imgRefresh.ImageUrl = GetImageUrl("CMSModules/CMS_PortalEngine/ContextMenu/Refresh.png"); this.lblRefresh.Text = ResHelper.GetString("PlaceholderMenu.IconRefresh", culture); this.imgRefresh.AlternateText = this.lblRefresh.Text; //this.lblRefresh.ToolTip = GetString("WebPartMenu.Refresh", culture); this.pnlRefresh.Attributes.Add("onclick", "RefreshPage();"); }