protected void Page_Load(object sender, EventArgs e) { if (dialogMode) { ScriptHelper.RegisterWOpenerScript(Page); } // Check permissions for web part properties UI // Check for UI permissions if (!CurrentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } // In case of opening via web part uni selector and transformation is hierarchical - redirect to hierarchical transformation string transName = QueryHelper.GetString("name", string.Empty); TransformationInfo hti = TransformationInfoProvider.GetTransformation(transName); if (hti != null) { if (hti.TransformationIsHierarchical) { URLHelper.Redirect(ResolveUrl(string.Format("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Transformations.aspx?transID={0}&editonlycode={1}&aliaspath={2}&instanceguid={3}", hti.TransformationID, QueryHelper.GetInteger("editonlycode", 0), QueryHelper.GetString("aliaspath", String.Empty), QueryHelper.GetGuid("instanceguid", Guid.Empty)))); } } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { viewElem.StopProcessing = true; repElem.StopProcessing = true; } else { // Get transformation name string transformationName = String.IsNullOrEmpty(TransformationName) ? SelectedItemTransformationName : TransformationName; if (!string.IsNullOrEmpty(transformationName)) { // Get transformation info TransformationInfo transformation = TransformationInfoProvider.GetTransformation(transformationName); // Get type of transformation if (transformation != null) { if (transformation.TransformationType == TransformationTypeEnum.Xslt) { // XSLT transformations (transform locally) isAscx = false; UseXSLT(); } else { // Other transformations (display using repeater) UseStandard(); } } } } }
protected void Page_Load(object sender, EventArgs e) { // Check security CurrentUserInfo currentUser = CMSContext.CurrentUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } UserInfo ui = CMSContext.CurrentUser; // If site manager set directly (or window not in dialog mode) - set site manager flag to unigrid // In some cases dialog mode may be used in site manager (hier. transformation) bool isSiteManager = QueryHelper.GetBoolean("sitemanager", false); if ((isSiteManager || !mDialogMode) && ui.UserSiteManagerAdmin) { ucTransf.IsSiteManager = true; } CurrentMaster.Title.Visible = true; int transformationID = QueryHelper.GetInteger("transID", 0); string selectedTemplate = QueryHelper.GetString("templatetype", String.Empty); if (!String.IsNullOrEmpty(ucTransf.SelectedItemType)) { selectedTemplate = ucTransf.SelectedItemType; } Guid guid = QueryHelper.GetGuid("guid", Guid.Empty); bool showInfoLabel = QueryHelper.GetBoolean("showinfo", false); TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationID); ucTransf.ShowInfoLabel = showInfoLabel; ucTransf.TransInfo = ti; ucTransf.HierarchicalID = guid; //Set breadcrumbs string[,] tabs = new string[2, 4]; tabs[0, 0] = GetString("documenttype_edit_transformation_list.titlelist"); tabs[0, 1] = ResolveUrl(String.Format("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Transformations.aspx?transID={0}&templatetype={1}&editonlycode={2}&tabmode={3}&aliaspath={4}&instanceguid={5}", ti.TransformationID, selectedTemplate, mDialogMode, QueryHelper.GetInteger("tabmode", 0), QueryHelper.GetString("aliaspath", String.Empty), QueryHelper.GetGuid("instanceguid", Guid.Empty))); tabs[0, 2] = ""; tabs[1, 0] = GetString("documenttype_edit_transformation_list.edit"); tabs[1, 1] = ""; tabs[1, 2] = ""; CurrentMaster.Title.HelpTopicName = "partialhierarchicalTransformation_tab"; CurrentMaster.Title.HelpName = "helpTopic"; CurrentMaster.Title.Breadcrumbs = tabs; if (mDialogMode) { pnlContainer.CssClass = "PageContent"; } }
protected void Page_Load(object sender, EventArgs e) { TreeNode currentDocument = DocumentContext.CurrentDocument; if (currentDocument != null) { // Get document type transformation string transformationName = currentDocument.NodeClassName + ".attachment"; TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName); // If transformation not present, use default from the Root document type if (ti == null) { transformationName = "cms.root.attachment"; ti = TransformationInfoProvider.GetTransformation(transformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!"); } ucAttachments.TransformationName = transformationName; ucAttachments.SiteName = SiteContext.CurrentSiteName; ucAttachments.Path = currentDocument.NodeAliasPath; ucAttachments.CultureCode = currentDocument.DocumentCulture; ucAttachments.OrderBy = "AttachmentOrder, AttachmentName"; ucAttachments.PageSize = 0; ucAttachments.GetBinary = false; ucAttachments.CacheMinutes = SettingsKeyInfoProvider.GetIntValue(SiteContext.CurrentSite + ".CMSCacheMinutes"); } }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void uniGrid_OnAction(string actionName, object actionArgument) { if (actionName.ToLowerCSafe() == "edit") { int transID = ValidationHelper.GetInteger(actionArgument, 0); if (transID != 0) { var ti = TransformationInfoProvider.GetTransformation(transID); if (ti != null) { var url = EditPageUrl; var query = String.Format( "objectid={0}&parentobjectid={1}&displaytitle=false&hash={2}{3}", transID, ClassID, QueryHelper.GetHash("?objectid=" + transID + "&parentobjectid=" + ClassID), (ModuleID > 0 ? "&moduleid=" + ModuleID : String.Empty) ); url = URLHelper.AppendQuery(url, query); URLHelper.Redirect(url); } } } else if (actionName.ToLowerCSafe() == "delete") { int transformationId = ValidationHelper.GetInteger(actionArgument, -1); if (transformationId > 0) { TransformationInfoProvider.DeleteTransformation(transformationId); } } }
/// <summary> /// Handles the UniGrid's OnAction event. /// </summary> /// <param name="actionName">Name of item (button) that throws event</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void uniGrid_OnAction(string actionName, object actionArgument) { if (actionName.ToLower() == "edit") { int transID = ValidationHelper.GetInteger(actionArgument, 0); if (transID != 0) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(transID); if (ti != null) { if (ti.TransformationIsHierarchical) { string isManager = IsSiteManager ? "&sitemanager=true" : String.Empty; URLHelper.Redirect(ResolveUrl("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Frameset.aspx?transid=" + transID + "&classid=" + this.ClassID.ToString() + "&tabmode=1" + isManager)); } else { URLHelper.Redirect(this.EditPageUrl + "?transformationid=" + transID.ToString() + "&classid=" + this.ClassID.ToString() + "&hash=" + QueryHelper.GetHash("?transformationid=" + transID + "&classid=" + ClassID)); } } } } else if (actionName.ToLower() == "delete") { int transformationId = ValidationHelper.GetInteger(actionArgument, -1); if (transformationId > 0) { TransformationInfoProvider.DeleteTransformation(transformationId); } } }
private void InitializeAddress() { if (Customer == null) { return; } var addresses = AddressInfoProvider.GetAddresses(Customer.CustomerID).ToArray(); foreach (AddressInfo addr in addresses) { if (!this.IsPostBack) { var li = new ListItem(addr.AddressID.ToString()); li.Value = addr.AddressID.ToString(); this.hiddenAddressesList.Items.Add(li); li.Selected = CurrentCartAddress != null ? CurrentCartAddress.AddressID == addr.AddressID : addresses.FirstOrDefault().Equals(addr); } var transformation = TransformationInfoProvider.GetTransformation("kda.checkoutpage.ShippingAddress"); var resolver = MacroResolver.GetInstance(); resolver.SetNamedSourceData("ShippingAddress", addr); resolver.SetNamedSourceData("StateCode", addr.GetStateCode()); resolver.SetNamedSourceData("Checked", (CurrentCartAddress != null ? CurrentCartAddress.AddressID == addr.AddressID : addresses.FirstOrDefault().Equals(addr)) ? "checked":""); htmlContent.Text += resolver.ResolveMacros(transformation.TransformationCode); } }
/// <summary> /// Load transformations with dependence. /// </summary> protected void LoadTransformations() { if (!String.IsNullOrEmpty(TransformationName)) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(TransformationName); if (ti != null) { // Setting up the common BasicUniView properties shoppingCartUniView.HierarchicalDisplayMode = HierarchicalDisplayModeEnum.Inner; shoppingCartUniView.RelationColumnID = "CartItemGuid"; if (ti.TransformationIsHierarchical) { // Setting up the hierarchical transformation. HierarchicalTransformations ht = new HierarchicalTransformations("CartItemGUID"); ht.LoadFromXML(ti.TransformationHierarchicalXMLDocument); // Setting up the BasicUniView shoppingCartUniView.Transformations = ht; shoppingCartUniView.UseNearestItemForHeaderAndFooter = true; } else { // Setting up the BasicUniView with a non-hierarchical transformation shoppingCartUniView.ItemTemplate = TransformationHelper.LoadTransformation(shoppingCartUniView, ti.TransformationFullName); } // Makes sure new data is loaded if the date changes and transformation needs to be reloaded shoppingCartUniView.DataBind(); } } }
private bool SetDialogMode() { if (!string.IsNullOrEmpty(mTransformationName)) { // Error message variable string errorMessage = null; // Get transformation info ti = TransformationInfoProvider.GetTransformation(mTransformationName); if (ti != null) { transformationId = ti.TransformationID; mClassName = DataClassInfoProvider.GetClassName(ti.TransformationClassID); // Check if document type is registered under current site DataSet ds = ClassSiteInfoProvider.GetClassSites("ClassID", "ClassID = " + ti.TransformationClassID + " AND SiteID = " + CMSContext.CurrentSiteID, null, -1); if (DataHelper.DataSourceIsEmpty(ds) && !user.UserSiteManagerAdmin) { // Set error message errorMessage = GetString("formcontrols_selecttransformation.classnotavailablesite").Replace("%%code%%", HTMLHelper.HTMLEncode(mClassName)); } else { tbTransformationName.ReadOnly = true; } } else { // Set error message errorMessage = GetString("formcontrols_selecttransformation.transofrmationnotexist").Replace("%%code%%", HTMLHelper.HTMLEncode(mTransformationName)); } // Hide panel Menu and write error message if (!String.IsNullOrEmpty(errorMessage)) { ShowError(errorMessage); pnlCheckOutInfo.Visible = plcControl.Visible = false; pnlContent.CssClass = "PageContent"; return(true); } } else { // Set page title mCurrentMaster.Title.TitleText = GetString("documenttype_edit_transformation_edit.newtransformation"); mCurrentMaster.Title.TitleImage = GetImageUrl("Objects/CMS_Transformation/transformation_new.png"); // Display class selector UseClassSelector = true; filter.SelectedValue = QueryHelper.GetString("selectedvalue", null); filter.FilterMode = SettingsObjectType.TRANSFORMATION; } pnlContent.CssClass = "PageContent"; SetDialogButtons(); return(false); }
protected void Page_Load(object sender, EventArgs e) { int transID = QueryHelper.GetInteger("transid", 0); if (transID != 0) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(transID); ucTransf.TransInfo = ti; } }
private void DisplayCouponCodes() { var transformation = TransformationInfoProvider.GetTransformation(CouponCodeTransformationName); if (transformation != null) { rptrCouponCodes.ItemTemplate = TransformationHelper.LoadTransformation(rptrCouponCodes, transformation.TransformationFullName); } rptrCouponCodes.DataSource = GetViewModel(); rptrCouponCodes.DataBind(); }
protected void btnOK_Click(object sender, EventArgs e) { if (TransInfo == null) { TransInfo = new TransformationInfo(); } string codeName = txtName.Text.Trim(); //Test if codename not empty string errorMessage = new Validator().NotEmpty(codeName, rfvCodeName.ErrorMessage).Result; //Test right format if ((errorMessage == "") && (!ValidationHelper.IsIdentifier(codeName.Trim()))) { errorMessage = GetString("general.erroridentificatorformat"); } if (errorMessage != String.Empty) { lblError.Text = errorMessage; lblError.Visible = true; return; } TransInfo.TransformationName = txtName.Text; //If edit no DocumentTypeID is set if (DocumentTypeID != 0) { TransInfo.TransformationClassID = DocumentTypeID; } //Save new Transformation TransformationInfo ti = TransformationInfoProvider.GetTransformation(TransInfo.TransformationFullName); if ((ti != null) && (ti.TransformationID != TransInfo.TransformationID)) { lblError.Text = GetString("DocumentType_Edit_Transformation_Edit.UniqueTransformationNameDocType"); lblError.Visible = true; return; } //Write info TransInfo.TransformationIsHierarchical = true; TransformationInfoProvider.SetTransformation(TransInfo); lblInfo.Visible = true; RaiseOnSaved(); // Reload header if changes were saved ScriptHelper.RefreshTabHeader(Page, GetString("general.general")); }
/// <summary> /// Binds data to basic repeater. /// </summary> protected void BindData() { // Dataset = connects repeater with data source if (UseClassicDataset) { BasicRepeater.DataSource = SPDataSource.DataSource; if (!DataHelper.DataSourceIsEmpty(BasicRepeater.DataSource)) { // Set proper transformations LoadTransformations(); BasicRepeater.DataBind(); } } // XSLT else { XmlNode caml = SPDataSource.DataSource as XmlNode; string transName = TransformationName; // If selected item is set if (SPDataSource.IsSelected && !String.IsNullOrEmpty(SelectedItemTransformationName)) { transName = SelectedItemTransformationName; } // Get transformation info TransformationInfo ti = TransformationInfoProvider.GetTransformation(transName); if ((caml != null) && (ti != null)) { // Check it is XSLT transformation if (ti.TransformationType != TransformationTypeEnum.Xslt) { DisplayError(string.Format(GetString("sharepoint.XSL"), ti.TransformationFullName)); return; } try { ltlTransformedOutput.Text = SharePointFunctions.TransformCAML(caml, ti); } catch (Exception ex) { // Show error DisplayError(string.Format(GetString("sharepoint.XSLTError") + ResHelper.Colon + " " + ex.Message)); DisplayError("XSLT error: " + ex.Message); } } } }
protected void Page_Load(object sender, EventArgs e) { // Check security var currentUser = MembershipContext.AuthenticatedUser; if (!currentUser.IsAuthorizedPerUIElement("CMS.Design", new[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, SiteContext.CurrentSiteName)) { RedirectToUIElementAccessDenied("CMS.Design", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } UserInfo ui = MembershipContext.AuthenticatedUser; // If site manager set directly (or window not in dialog mode) - set site manager flag to unigrid // In some cases dialog mode may be used in site manager (hier. transformation) bool isSiteManager = QueryHelper.GetBoolean("sitemanager", false); if ((isSiteManager || !editOnlyCode) && ui.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin)) { ucTransf.IsSiteManager = true; } PageTitle.Visible = true; int transformationID = QueryHelper.GetInteger("objectid", 0); string selectedTemplate = QueryHelper.GetString("templatetype", String.Empty); if (!String.IsNullOrEmpty(ucTransf.SelectedItemType)) { selectedTemplate = ucTransf.SelectedItemType; } Guid guid = QueryHelper.GetGuid("guid", Guid.Empty); bool showInfoLabel = QueryHelper.GetBoolean("showinfo", false); TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationID); ucTransf.ShowInfoLabel = showInfoLabel; ucTransf.TransInfo = ti; ucTransf.HierarchicalID = guid; //Set breadcrumbs PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("documenttype_edit_transformation_list.titlelist"), RedirectUrl = ResolveUrl(String.Format("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Transformations.aspx?objectid={0}&templatetype={1}&editonlycode={2}&tabmode={3}&aliaspath={4}&instanceguid={5}", ti.TransformationID, selectedTemplate, editOnlyCode, QueryHelper.GetInteger("tabmode", 0), QueryHelper.GetString("aliaspath", String.Empty), QueryHelper.GetGuid("instanceguid", Guid.Empty))) }); PageBreadcrumbs.Items.Add(new BreadcrumbItem { Text = GetString("documenttype_edit_transformation_list.edit"), }); }
protected void Page_Load(object sender, EventArgs e) { ucAttachments = Page.LoadUserControl("~/CMSModules/Content/Controls/Attachments/AttachmentLightboxGallery.ascx") as CMSUserControl; ucAttachments.ID = "ctrlAttachments"; plcAttachmentLightBox.Controls.Add(ucAttachments); TreeNode currentDocument = DocumentContext.CurrentDocument; if (currentDocument != null) { // Get document type transformation string transformationName = currentDocument.NodeClassName + ".AttachmentLightbox"; string selectedTransformationName = currentDocument.NodeClassName + ".AttachmentLightboxDetail"; TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationName); // If transformation not present, use default from the Root document type if (ti == null) { transformationName = "cms.root.AttachmentLightbox"; ti = TransformationInfoProvider.GetTransformation(transformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + transformationName + "' doesn't exist!"); } ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); // If transformation not present, use default from the Root document type if (ti == null) { selectedTransformationName = "cms.root.AttachmentLightboxDetail"; ti = TransformationInfoProvider.GetTransformation(selectedTransformationName); } if (ti == null) { throw new Exception("[DocumentAttachments]: Default transformation '" + selectedTransformationName + "' doesn't exist!"); } ucAttachments.SetValue("TransformationName", transformationName); ucAttachments.SetValue("SelectedItemTransformationName", selectedTransformationName); ucAttachments.SetValue("SiteName", SiteContext.CurrentSiteName); ucAttachments.SetValue("Path", currentDocument.NodeAliasPath); ucAttachments.SetValue("CultureCode", currentDocument.DocumentCulture); ucAttachments.SetValue("OrderBy", "AttachmentOrder, AttachmentName"); ucAttachments.SetValue("PageSize", 0); ucAttachments.SetValue("GetBinary", false); ucAttachments.SetValue("CacheMinutes", SettingsKeyInfoProvider.GetIntValue(SiteContext.CurrentSite + ".CMSCacheMinutes")); } }
/// <summary> /// Renders script for custom transformation. /// </summary> /// <param name="renderer">Instance of Strands script renderer</param> /// <param name="template">Selected template</param> /// <exception cref="StrandsException">Transformation does not exist</exception> private void RenderCustomTransformation(StrandsScriptRenderer renderer, StrandsWebTemplateData template) { var transformation = TransformationInfoProvider.GetTransformation(CustomTransformation); if (transformation == null) { throw new StrandsException("[StrandsRecommendations.ParseRecommendationTemplate]: Cannot load the transformation specified in the web part.", ResHelper.GetString("strands.recommendations.transformations.errorloadingtransformation")); } if (transformation.TransformationType != TransformationTypeEnum.jQuery) { throw new StrandsException("[StrandsRecommendations.ParseRecommendationTemplate]: Transformation type has to be of type jQuery.", ResHelper.GetString("strands.recommendations.transformations.wrongtype")); } renderer.RenderCustomizedRendererScript(transformation, template.ID, strandsRecs.ClientID); }
/// <summary> /// Initialize filter. /// </summary> public void Initialize() { if (!String.IsNullOrEmpty(SelectedValue)) { switch (FilterMode) { case PortalObjectType.TRANSFORMATION: TransformationInfo ti = TransformationInfoProvider.GetTransformation(SelectedValue); if (ti != null) { mSelectedClass = DataClassInfoProvider.GetDataClass(ti.TransformationClassID); } break; case SettingsObjectType.QUERY: Query q = QueryProvider.GetQuery(SelectedValue, false); if (q != null) { mSelectedClass = DataClassInfoProvider.GetDataClass(q.QueryClassId); } break; } // If selected object is under custom class, change selected class type if (mSelectedClass != null) { if (mSelectedClass.ClassIsCustomTable) { lblDocType.Text = ResHelper.GetString("queryselection.customtable"); ListItem selectedItem = ControlsHelper.FindItemByValue(drpClassType, "customtables", false); // Select item which is already loaded in drop-down list if (selectedItem != null) { drpClassType.SelectedValue = selectedItem.Value; } } else if (!mSelectedClass.ClassIsDocumentType) { mSelectedClass = null; return; } uniSelector.Value = mSelectedClass.ClassID; } } }
/// <summary> /// Initialize filter. /// </summary> public void Initialize() { if (!String.IsNullOrEmpty(SelectedValue)) { switch (FilterMode) { case TransformationInfo.OBJECT_TYPE: TransformationInfo ti = TransformationInfoProvider.GetTransformation(SelectedValue); if (ti != null) { mSelectedClass = DataClassInfoProvider.GetDataClassInfo(ti.TransformationClassID); } break; case QueryInfo.OBJECT_TYPE: var q = QueryInfoProvider.GetQueryInfo(SelectedValue, throwException: false); if (q != null) { mSelectedClass = DataClassInfoProvider.GetDataClassInfo(q.ClassID); } break; } // If selected object is under custom class, change selected class type if (mSelectedClass != null) { if (mSelectedClass.ClassIsCustomTable) { lblDocType.ResourceString = "queryselection.customtable"; ListItem selectedItem = ControlsHelper.FindItemByValue(drpClassType, "customtables", false); // Select item which is already loaded in drop-down list if (selectedItem != null) { drpClassType.SelectedValue = selectedItem.Value; } } else if (!mSelectedClass.ClassIsDocumentType) { mSelectedClass = null; return; } uniSelector.Value = mSelectedClass.ClassID; } } }
/// <summary> /// Initialize filter. /// </summary> private void Initialize() { if (!String.IsNullOrEmpty(SelectedValue)) { DataClassInfo selectedClass = null; switch (FilterMode) { case TransformationInfo.OBJECT_TYPE: var transformation = TransformationInfoProvider.GetTransformation(SelectedValue); if (transformation != null) { selectedClass = DataClassInfoProvider.GetDataClassInfo(transformation.TransformationClassID); } break; case QueryInfo.OBJECT_TYPE: var query = QueryInfoProvider.GetQueryInfo(SelectedValue, false); if (query != null) { selectedClass = DataClassInfoProvider.GetDataClassInfo(query.ClassID); } break; } // If selected object is under custom class, change selected class type if (selectedClass != null) { if (selectedClass.ClassIsCustomTable) { var selectedItem = ControlsHelper.FindItemByValue(drpClassType, CUSTOM_TABLE, false); // Select item which is already loaded in drop-down list if (selectedItem != null) { drpClassType.SelectedValue = selectedItem.Value; } } else if (!selectedClass.ClassIsDocumentType) { return; } uniSelector.Value = selectedClass.ClassID; } } }
private void GetParameters() { // Gets classID from querystring, used when creating new transformation mClassId = QueryHelper.GetInteger(ParameterName, 0); if (mClassId > 0) { mClassName = DataClassInfoProvider.GetClassName(mClassId); } // Gets transformationID from querystring, used when editing transformation transformationId = QueryHelper.GetInteger("transformationid", 0); if (transformationId > 0) { // Get the transformation ti = TransformationInfoProvider.GetTransformation(transformationId); CMSPage.EditedObject = ti; mTransformationName = ti.TransformationName; mClassName = DataClassInfoProvider.GetClassName(ti.TransformationClassID); mClassId = DataClassInfoProvider.GetDataClass(mClassName).ClassID; if (!RequestHelper.IsPostBack()) { // Shows that the new transformation was created or updated successfully if (QueryHelper.GetBoolean("saved", false)) { ShowInfo(GetString("General.ChangesSaved")); } } } else { ti.TransformationFullName = string.Empty; } DialogMode = QueryHelper.GetBoolean("editonlycode", false); if (DialogMode) { mTransformationName = QueryHelper.GetString("name", string.Empty); } EditMode = mTransformationName != string.Empty; }
/// <summary> /// Gets the transformation object for current context /// </summary> private TransformationInfo GetTransformation() { var ti = TransformationInfoProvider.GetTransformation(QueryHelper.GetInteger("objectid", 0)); if (ti == null) { // Load transformation by name ti = TransformationInfoProvider.GetTransformation(QueryHelper.GetString("objectid", "")); // Setup context properly var ctx = Control.UIContext; ctx.EditedObject = ti; ctx.ObjectID = ti.TransformationID; } return(ti); }
private void InitEditedObject() { if (PersistentEditedObject != null) { transformation = PersistentEditedObject as TransformationInfo; return; } if (transformationId > 0) { transformation = TransformationInfoProvider.GetTransformation(transformationId); } else { transformation = TransformationInfoProvider.GetTransformation(transformationName); } PersistentEditedObject = transformation; }
/// <summary> /// Retrieves the stylesheets of the web part layout from the database. /// </summary> /// <param name="layoutFullName">Layout full name</param> /// <returns>The stylesheet data (plain version only)</returns> private static CMSOutputResource GetTransformation(string transformationFullName) { TransformationInfo transformationInfo = TransformationInfoProvider.GetTransformation(transformationFullName); if (transformationInfo == null) { return(null); } // Build the result CMSOutputResource resource = new CMSOutputResource() { Data = HTMLHelper.ResolveCSSUrls(transformationInfo.TransformationCSS, URLHelper.ApplicationPath), LastModified = transformationInfo.TransformationLastModified, Etag = transformationInfo.TransformationVersionGUID }; return(resource); }
/// <summary> /// Displays multibuy and order discounts summary based on provided transformation. /// </summary> private void DisplayOrderDiscountSummary() { if (!string.IsNullOrEmpty(OrderDiscountSummaryTransformationName)) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(OrderDiscountSummaryTransformationName); if (ti == null) { return; } uvMultiBuySummary.Visible = true; uvMultiBuySummary.DataSource = ShoppingCart.OrderRelatedDiscountSummaryItems; uvMultiBuySummary.ItemTemplate = CMSAbstractDataProperties.LoadTransformation(uvMultiBuySummary, ti.TransformationFullName); // Makes sure new data is loaded if the date changes and transformation needs to be reloaded uvMultiBuySummary.DataBind(); uvMultiBuySummary.ReloadData(true); } }
/// <summary> /// Returns true if user control is valid. /// </summary> public override bool IsValid() { // If macro or special value, do not validate string value = uniSelector.TextBoxSelect.Text.Trim(); if (!ContextResolver.ContainsMacro(value) && (value != string.Empty)) { // Check if culture exists TransformationInfo ti = TransformationInfoProvider.GetTransformation(value); if (ti == null) { ValidationError = GetString("formcontrols_selecttransformation.notexist").Replace("%%code%%", value); return(false); } else { return(true); } } return(true); }
protected void Page_Load(object sender, EventArgs e) { // Setup the file system browser int transformationId = QueryHelper.GetInteger("transformationid", 0); if (transformationId > 0) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationId); EditedObject = ti; if (ti != null) { // Ensure the theme folder themeElem.Path = ti.GetThemePath(); } } else { EditedObject = null; } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { viewElem.StopProcessing = true; repElem.StopProcessing = true; } else { // Get transformation name string mTransformationName = DataHelper.GetNotEmpty(GetValue("TransformationName"), string.Empty); if (!string.IsNullOrEmpty(mTransformationName)) { // Get transformation info TransformationInfo mTransformation = TransformationInfoProvider.GetTransformation(mTransformationName); if ((mTransformation == null) && (PageManager.ViewMode != ViewModeEnum.Design)) { throw new Exception("[WebPart.CMSDocumentViever]: Transformation " + mTransformationName + " not found!"); } // Get type of transformation if (mTransformation != null) { if (mTransformation.TransformationType == TransformationTypeEnum.Xslt) { // XSLT transformations (transform locally) isAscx = false; UseXSLT(); } else { // Other transformations (display using repeater) UseStandard(); } } } } }
protected void Page_Load(object sender, EventArgs e) { // Setup the filesystem browser int transformationId = QueryHelper.GetInteger("transformationid", 0); if (transformationId > 0) { TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationId); EditedObject = ti; DataClassInfo dci = DataClassInfoProvider.GetDataClass(ti.TransformationClassID); if (dci != null) { // Ensure the theme folder themeElem.Path = "~/App_Themes/Components/Transformations/" + ValidationHelper.GetSafeFileName(dci.ClassName) + "/" + ValidationHelper.GetSafeFileName(ti.TransformationName); } } else { EditedObject = null; } }
protected void Page_Load(object sender, EventArgs e) { // Check permissions for web part properties UI CurrentUserInfo currentUser = CMSContext.CurrentUser; UserInfo ui = CMSContext.CurrentUser; bool isSiteManager = QueryHelper.GetBoolean("sitemanager", false); // Site manager may be used in dialog mode too (hierar. transformations) if ((isSiteManager || !mDialogMode) && ui.UserSiteManagerAdmin) { transformationEdit.IsSiteManager = true; } // Check if existing transformation is edited or created if (QueryHelper.Contains("name")) { // Check for UI permissions if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } } else { // Check for UI permissions if (!currentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.NewTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.NewTransformations"); } } // In case of opening via web part uni selector and transformation is hierarchical - redirect to hierarchical transformation string transName = QueryHelper.GetString("name", string.Empty); TransformationInfo hti = TransformationInfoProvider.GetTransformation(transName); if (hti != null) { if (hti.TransformationIsHierarchical) { URLHelper.Redirect(ResolveUrl(string.Format("~/CMSModules/DocumentTypes/Pages/Development/HierarchicalTransformations_Transformations.aspx?transID={0}&editonlycode={1}", hti.TransformationID, QueryHelper.GetInteger("editonlycode", 0)))); } EditedObject = hti; } else { int transId = QueryHelper.GetInteger("transformationid", 0); hti = TransformationInfoProvider.GetTransformation(transId); if (hti != null) { EditedObject = hti; } } if (hti == null) { transformationEdit.EditingPage = "DocumentType_Edit_Transformation_Frameset.aspx"; } else { transformationEdit.EditingPage = "DocumentType_Edit_Transformation_Edit.aspx"; } // Reload header if changes were saved if (QueryHelper.GetInteger("saved", 0) == 1) { ScriptHelper.RefreshTabHeader(Page, null); } }
protected void Page_Load(object sender, EventArgs e) { // Check for UI permissions if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.Content", new string[] { "Design", "Design.WebPartProperties", "WebPartProperties.General", "WebPartProperties.EditTransformations" }, CMSContext.CurrentSiteName)) { RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Design.WebPartProperties;WebPartProperties.General;WebPartProperties.EditTransformations"); } UserInfo ui = CMSContext.CurrentUser; ucNewTransf.IsSiteManager = !mDialogMode && ui.UserSiteManagerAdmin; CurrentMaster.Title.Visible = true; int transformationID = QueryHelper.GetInteger("transID", 0); bool add = QueryHelper.GetBoolean("add", false); string templateType = QueryHelper.GetString("templatetype", "all"); if (!RequestHelper.IsPostBack()) { // Load transformations drpTransformations.Items.Add(new ListItem(GetString("hiertransf.all"), "all")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.item"), "item")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.alternatingitem"), "alternatingitem")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.firstitem"), "firstitem")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.lastitem"), "lastitem")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.header"), "header")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.footer"), "footer")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.singleitem"), "singleitem")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.separator"), "separator")); drpTransformations.Items.Add(new ListItem(GetString("hiertransf.currentitem"), "currentitem")); } // Try to load hierarchical transformations TransformationInfo ti = TransformationInfoProvider.GetTransformation(transformationID); ucNewTransf.TransInfo = ti; ucTransf.TransInfo = ti; ucTransf.DialogMode = mDialogMode; if (!String.IsNullOrEmpty(drpTransformations.SelectedValue)) { templateType = drpTransformations.SelectedValue; } else { drpTransformations.SelectedValue = templateType; } ucTransf.TemplateType = templateType; if (!add) { // Show new transformation link string[,] actions = new string[2, 6]; actions[0, 0] = HeaderActions.TYPE_HYPERLINK; actions[0, 1] = GetString("DocumentType_Edit_Transformation_List.btnAdd"); actions[0, 2] = null; actions[0, 3] = ResolveUrl("HierarchicalTransformations_Transformations.aspx?add=true&transID=" + transformationID.ToString() + "&templatetype=" + templateType + "&editonlycode=" + mDialogMode + "&tabmode=" + QueryHelper.GetInteger("tabmode", 0)); actions[0, 5] = GetImageUrl("Objects/CMS_Transformation/hierarchicalTransformation.png"); this.CurrentMaster.HeaderActions.Actions = actions; this.CurrentMaster.DisplayControlsPanel = true; } else { // Set breadcrumbs string[,] tabs = new string[2, 4]; tabs[0, 0] = GetString("documenttype_edit_transformation_list.titlelist"); tabs[0, 1] = ResolveUrl("HierarchicalTransformations_Transformations.aspx?transID=" + transformationID.ToString() + "&templatetype=" + templateType + "&editonlycode=" + mDialogMode + "&tabmode=" + QueryHelper.GetInteger("tabmode", 0)); tabs[0, 2] = ""; tabs[1, 0] = GetString("documenttype_edit_transformation_list.btnAdd"); tabs[1, 1] = ""; tabs[1, 2] = ""; ucNewTransf.Visible = true; ucTransf.Visible = false; ucNewTransf.OnSaved += new EventHandler(ucNewTransf_OnSaved); this.CurrentMaster.Title.Breadcrumbs = tabs; } // Set proper position for templates list if (!RequestHelper.IsPostBack()) { if (templateType != String.Empty) { ucTransf.TemplateType = templateType; } } if (mDialogMode) { pnlContainer.CssClass = "PageContent"; } }