예제 #1
0
        protected override void OnLoad(EventArgs e)
        {
            UITools.CheckConnection(Page);
            if (!SessionState.User.HasCapability(Business.CapabilitiesEnum.MANAGE_RESOURCES))
            {
                Response.End();
                return;
            }

            propertiesMsgLbl.Visible = false;

            mTb.Items.FromKeyButton("Add").Visible = completePanel.Visible = (DisplayMode == Mode.Complete);
            minimalCell.ColSpan = (DisplayMode == Mode.Complete?1:3);

            if (!IsPostBack)
            {
                #region init grids
                Utils.InitGridSort(ref rGd);
                //Utils.InitGridSort(ref variantsGrid);
                #endregion

                HyperCatalog.Business.CultureList cultures = HyperCatalog.Business.Culture.GetAll();
                if (cultures != null)
                {
                    cultures.Sort("Name ASC");
                }
                txtVariantCultureValue.DataSource = cultures;
                txtVariantCultureValue.DataBind();

                if (Request["l"] != null)
                {
                    try
                    {
                        _currentLibraryId = Convert.ToInt32(Request["l"]);
                    }
                    catch {}
                }
                if (_currentLibraryId < 0 && Session["DAM_currentLibraryId"] is int)
                {
                    _currentLibraryId = (int)Session["DAM_currentLibraryId"];
                }

                BindDAM();
            }


            base.OnLoad(e);
        }
예제 #2
0
        protected override void OnLoad(EventArgs e)
        {
            if (this.Visible)
            {
                if (DisplayMode == Mode.Complete && !SessionState.User.HasCapability(Business.CapabilitiesEnum.MANAGE_RESOURCES))
                {
                    UITools.DenyAccess(DenyMode.Frame);
                }

                #region init grids
                Utils.InitGridSort(ref rGd);
                //Utils.InitGridSort(ref variantsGrid);
                #endregion

                propertiesMsgLbl.Visible = false;

                mTb.Items.FromKeyButton("Add").Visible = completePanel.Visible = (DisplayMode == Mode.Complete);
                minimalCell.ColSpan = (DisplayMode == Mode.Complete ? 1 : 3);

                if (!IsPostBack)
                {
                    HyperCatalog.Business.CultureList cultures = HyperCatalog.Business.Culture.GetAll();
                    _currentCultureCode = HyperCatalog.Shared.SessionState.MasterCulture.Code;
                    if (cultures != null)
                    {
                        cultures.Sort("Name ASC");
                    }
                    txtVariantCultureValue.DataSource = cultures;
                    txtVariantCultureValue.DataBind();

                    _currentResourceId = -1;
                    _currentLibrary    = null;
                    _resourceTypes     = null;
                    if (Request["l"] != null)
                    {
                        try
                        {
                            _currentLibraryId = Convert.ToInt32(Request["l"]);
                        }
                        catch { }
                    }
                    else if (Request["resource"] != null)
                    {
                        try
                        {
                            string[] splitted = Request["resource"].Split('/');
                            if (splitted.Length == 2)
                            {
                                _currentLibrary = Library.GetByKey(splitted[0]);
                                if (_currentLibrary != null)
                                {
                                    _currentResource = _currentLibrary.Resources[splitted[1].Split('.')[0]];
                                }
                            }
                        }
                        catch { }
                    }
                    if (Request["culture"] != null)
                    {
                        CurrentCultureCode = Request["culture"];
                    }
                    if (_currentLibraryId < 0 && Session["DAM_currentLibraryId"] is int)
                    {
                        _currentLibraryId = (int)Session["DAM_currentLibraryId"];
                    }

                    BindDAM();
                }
            }
            base.OnLoad(e);

            //Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "ChgLib", "function ChgLib(libId){window.location='" + Request.Url.PathAndQuery.Substring(0, Request.Url.PathAndQuery.Length - Request.Url.Query.Length) + "?w=" + WorkspaceId.ToString() + "&l=' + libId;}", true);
            //libraryList.Attributes.Add("onchange", "ChgLib(this.value)");
        }