Esempio n. 1
0
    /// <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();
            }
        }
    }
    /// <summary>
    /// Load transformation for xml usage.
    /// </summary>
    private HierarchicalTransformations LoadTransformation()
    {
        HierarchicalTransformations transformations = new HierarchicalTransformations("ClassName");

        if (TransInfo != null)
        {
            if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
            {
                transformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
            }
        }
        return(transformations);
    }
    /// <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 = CMS.Controls.CMSDataProperties.LoadTransformation(shoppingCartUniView, ti.TransformationFullName);
                }

                // Makes sure new data is loaded if the date changes and transformation needs to be reloaded
                shoppingCartUniView.DataBind();
            }
        }
    }
 /// <summary>
 /// Load transformation for xml usage.
 /// </summary>
 private HierarchicalTransformations LoadTransformation()
 {
     HierarchicalTransformations transformations = new HierarchicalTransformations("ClassName");
     if (TransInfo != null)
     {
         if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
         {
             transformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
         }
     }
     return transformations;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        string templateType = QueryHelper.GetString("templatetype", String.Empty);

        // If not in site manager - filter class selector for only site documents
        if (!IsSiteManager)
        {
            ucClassSelector.SiteID = CMSContext.CurrentSiteID;
        }

        if (!RequestHelper.IsPostBack())
        {
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.item"), "item"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.alternatingitem"), "alternatingitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.firstitem"), "firstitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.lastitem"), "lastitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.header"), "header"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.footer"), "footer"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.singleitem"), "singleitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.separator"), "separator"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.currentitem"), "currentitem"));

            //If new template type set via url
            if (!String.IsNullOrEmpty(templateType))
            {
                //lblTemplateType.Text = ConvertTemplateTypeToString(templateType);
                if (templateType != "all")
                {
                    drpTemplateType.SelectedValue = templateType;
                }
                else
                {
                    drpTemplateType.SelectedValue = "item";
                }
            }
        }

        //Info and error messages
        lblInfo.Text = GetString("general.changessaved");

        //First edit after save ... show info message
        if (ShowInfoLabel)
        {
            lblInfo.Visible = true;
        }

        if (!String.IsNullOrEmpty(templateType))
        {
            mTemplateType = HierarchicalTransformations.StringToUniViewItemType(templateType);
        }

        //Load transformations xml
        mTransformations = new HierarchicalTransformations("ClassName");
        if (TransInfo != null)
        {
            if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
            {
                mTransformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
            }
        }

        //Edit
        if (HierarchicalID != Guid.Empty)
        {
            mHierInfo = mTransformations.GetTransformation(HierarchicalID);
            //Load Transformation values
            if (!RequestHelper.IsPostBack())
            {
                txtLevel.Text                 = mHierInfo.ItemLevel.ToString();
                ucTransformations.Value       = mHierInfo.TransformationName;
                ucClassSelector.Value         = mHierInfo.Value;
                templateType                  = HierarchicalTransformations.UniViewItemTypeToString(mHierInfo.ItemType);
                drpTemplateType.SelectedValue = templateType;
                mTemplateType                 = mHierInfo.ItemType;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string templateType = QueryHelper.GetString("templatetype", String.Empty);

        // If not in site manager - filter class selector for only site documents
        if (!IsSiteManager)
        {
            ucClassSelector.SiteID = SiteContext.CurrentSiteID;
        }

        if (!RequestHelper.IsPostBack())
        {
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.item"), "item"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.alternatingitem"), "alternatingitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.firstitem"), "firstitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.lastitem"), "lastitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.header"), "header"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.footer"), "footer"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.singleitem"), "singleitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.separator"), "separator"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.currentitem"), "currentitem"));

            //If new template type set via url
            if (!String.IsNullOrEmpty(templateType))
            {
                drpTemplateType.SelectedValue = templateType == "all" ? "item" : templateType;
            }
        }

        //First edit after save ... show info message
        if (ShowInfoLabel)
        {
            ShowChangesSaved();
        }

        //Load transformations xml
        mTransformations = new HierarchicalTransformations("ClassName");
        if (TransInfo != null)
        {
            if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
            {
                mTransformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
            }
        }

        //Edit
        if (HierarchicalID != Guid.Empty)
        {
            mHierInfo = mTransformations.GetTransformation(HierarchicalID);
            //Load Transformation values
            if (!RequestHelper.IsPostBack())
            {
                txtLevel.Text = mHierInfo.ItemLevel.ToString();
                ucTransformations.Value = mHierInfo.TransformationName;
                ucClassSelector.Value = mHierInfo.Value;
                templateType = HierarchicalTransformations.UniViewItemTypeToString(mHierInfo.ItemType);
                drpTemplateType.SelectedValue = templateType;
                chkApplyToSublevels.Checked = mHierInfo.ApplyToSublevels;
            }
        }

        // Disable class selector for separator, header and foot transformation
        ucClassSelector.Enabled = true;
        if ((drpTemplateType.SelectedValue == "header") || (drpTemplateType.SelectedValue == "footer") || (drpTemplateType.SelectedValue == "separator"))
        {
            ucClassSelector.Value = "";
            ucClassSelector.Enabled = false;
        }

        // Add save button
        if (Visible)
        {
            HeaderActions.AddAction(new SaveAction());
            HeaderActions.ActionPerformed += btnOK_Click;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string templateType = QueryHelper.GetString("templatetype", String.Empty);

        // If not in site manager - filter class selector for only site documents
        if (!IsSiteManager)
        {
            ucClassSelector.SiteID = SiteContext.CurrentSiteID;
        }

        if (!RequestHelper.IsPostBack())
        {
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.item"), "item"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.alternatingitem"), "alternatingitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.firstitem"), "firstitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.lastitem"), "lastitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.header"), "header"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.footer"), "footer"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.singleitem"), "singleitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.separator"), "separator"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.currentitem"), "currentitem"));

            //If new template type set via url
            if (!String.IsNullOrEmpty(templateType))
            {
                drpTemplateType.SelectedValue = templateType == "all" ? "item" : templateType;
            }
        }

        //First edit after save ... show info message
        if (ShowInfoLabel)
        {
            ShowChangesSaved();
        }

        //Load transformations xml
        mTransformations = new HierarchicalTransformations("ClassName");
        if (TransInfo != null)
        {
            if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
            {
                mTransformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
            }
        }

        //Edit
        if (HierarchicalID != Guid.Empty)
        {
            mHierInfo = mTransformations.GetTransformation(HierarchicalID);
            //Load Transformation values
            if (!RequestHelper.IsPostBack())
            {
                txtLevel.Text                 = mHierInfo.ItemLevel.ToString();
                ucTransformations.Value       = mHierInfo.TransformationName;
                ucClassSelector.Value         = mHierInfo.Value;
                templateType                  = HierarchicalTransformations.UniViewItemTypeToString(mHierInfo.ItemType);
                drpTemplateType.SelectedValue = templateType;
                chkApplyToSublevels.Checked   = mHierInfo.ApplyToSublevels;
            }
        }

        // Disable class selector for separator, header and foot transformation
        ucClassSelector.Enabled = true;
        if ((drpTemplateType.SelectedValue == "header") || (drpTemplateType.SelectedValue == "footer") || (drpTemplateType.SelectedValue == "separator"))
        {
            ucClassSelector.Value   = "";
            ucClassSelector.Enabled = false;
        }

        // Add save button
        if (Visible)
        {
            HeaderActions.AddAction(new SaveAction(Page));
            HeaderActions.ActionPerformed += btnOK_Click;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string templateType = QueryHelper.GetString("templatetype", String.Empty);

        // If not in site manager - filter class selector for only site documents
        if (!IsSiteManager)
        {
            ucClassSelector.SiteID = CMSContext.CurrentSiteID;
        }

        if (!RequestHelper.IsPostBack())
        {
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.item"), "item"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.alternatingitem"), "alternatingitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.firstitem"), "firstitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.lastitem"), "lastitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.header"), "header"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.footer"), "footer"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.singleitem"), "singleitem"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.separator"), "separator"));
            drpTemplateType.Items.Add(new ListItem(GetString("hiertransf.currentitem"), "currentitem"));

            //If new template type set via url
            if (!String.IsNullOrEmpty(templateType))
            {
                //lblTemplateType.Text = ConvertTemplateTypeToString(templateType);
                if (templateType != "all")
                {
                    drpTemplateType.SelectedValue = templateType;
                }
                else
                {
                    drpTemplateType.SelectedValue = "item";
                }
            }
        }

        //Info and error messages
        lblInfo.Text = GetString("general.changessaved");

        //First edit after save ... show info message
        if (ShowInfoLabel)
        {
            lblInfo.Visible = true;
        }

        if (!String.IsNullOrEmpty(templateType))
        {
            mTemplateType = HierarchicalTransformations.StringToUniViewItemType(templateType);
        }

        //Load transformations xml
        mTransformations = new HierarchicalTransformations("ClassName");
        if (TransInfo != null)
        {
            if (!String.IsNullOrEmpty(TransInfo.TransformationHierarchicalXML))
            {
                mTransformations.LoadFromXML(TransInfo.TransformationHierarchicalXML);
            }
        }

        //Edit
        if (HierarchicalID != Guid.Empty)
        {
            mHierInfo = mTransformations.GetTransformation(HierarchicalID);
            //Load Transformation values
            if (!RequestHelper.IsPostBack())
            {
                txtLevel.Text = mHierInfo.ItemLevel.ToString();
                ucTransformations.Value = mHierInfo.TransformationName;
                ucClassSelector.Value = mHierInfo.Value;
                templateType = HierarchicalTransformations.UniViewItemTypeToString(mHierInfo.ItemType);
                drpTemplateType.SelectedValue = templateType;
                mTemplateType = mHierInfo.ItemType;
            }
        }
    }