Ejemplo n.º 1
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        _MessageHelper = _Common.EkMsgRef;
            AppImgPath = _Common.AppImgPath;
            AppPath = _Common.AppPath;
            _PageAction = Request.QueryString["action"];

            if (!string.IsNullOrEmpty(Request.QueryString["reloadtrees"]))
            {
                reloadTree = true;
            }

            object refCommon = _Common as object;
            Utilities.SetLanguage(_Common);
            //Utilities.SetLanguage(_Common);
            RegisterResources();
            TaxonomyLanguage = _Common.ContentLanguage;
            TaxonomyId = Convert.ToInt64(Request.QueryString["taxonomyid"]);
            if (Request.QueryString["view"] != null)
            {
                _ViewItem = AntiXss.HtmlEncode(Request.QueryString["view"]);
            }
            taxonomy_request = new TaxonomyRequest();
            taxonomy_request.TaxonomyId = TaxonomyId;
            taxonomy_request.TaxonomyLanguage = TaxonomyLanguage;
            _Content = _Common.EkContentRef;
            taxonomy_request.PageSize = 99999999; // pagesize of 0 used to mean "all"
            TaxonomyBaseData[] taxcats;
            taxcats = _Content.ReadAllSubCategories(taxonomy_request);
            if (taxcats != null)
            {
                TaxonomyCategoryCount = taxcats.Length;
            }
            if (Page.IsPostBack && Request.Form[isPostData.UniqueID] != "")
            {
                if (Request.Form["submittedaction"] == "delete")
                {
                    _Content.DeleteTaxonomy(taxonomy_request);
                    //Response.Write("<script type=""text/javascript"">parent.CloseChildPage();</script>")
                    Response.Redirect("taxonomy.aspx?action=reload&rf=1&reloadtrees=Tax", true);
                }
                else if (Request.Form["submittedaction"] == "deleteitem")
                {
                    if (_ViewItem != "folder")
                    {
                        taxonomy_request.TaxonomyIdList = Request.Form["selected_items"];
                        if (_ViewItem.ToLower() == "cgroup")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Group;
                        }
                        else if (_ViewItem.ToLower() == "user")
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.User;
                        }
                        else
                        {
                            taxonomy_request.TaxonomyItemType = EkEnumeration.TaxonomyItemType.Content;
                        }
                        _Content.RemoveTaxonomyItem(taxonomy_request);
                    }
                    else
                    {
                        TaxonomySyncRequest tax_folder = new TaxonomySyncRequest();
                        tax_folder.TaxonomyId = TaxonomyId;
                        tax_folder.TaxonomyLanguage = TaxonomyLanguage;
                        tax_folder.SyncIdList = Request.Form["selected_items"];
                        _Content.RemoveTaxonomyFolder(tax_folder);
                    }
                    if (Request.Params["ccp"] == null)
                    {
                        Response.Redirect("taxonomy.aspx?" + Request.ServerVariables["query_string"] + "&ccp=true", true);
                    }
                    else
                    {
                        Response.Redirect((string) ("taxonomy.aspx?" + Request.ServerVariables["query_string"]), true);
                    }
                }
            }
            else if (IsPostBack == false)
            {
                DisplayPage();
            }
            AssignTextStrings();
            isPostData.Value = "true";
            hdnSourceId.Value = TaxonomyId.ToString();
    }