Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            pAll.Visible = false;
            if ((Request.IsAuthenticated))
            {
                UserInfo user = UserController.GetCurrentUserInfo();
                if (((user != null)))
                {
                    bool isAdmin = user.IsInRole(PortalSettings.AdministratorRoleName);
                    if (isAdmin &&
                        !PortalSettings.ActiveTab.IsSuperTab &&
                        PortalSettings.ActiveTab.TabID != PortalSettings.AdminTabId &&
                        PortalSettings.ActiveTab.ParentId != PortalSettings.AdminTabId)
                    {
                        pAll.Visible = true;
                    }
                }
            }
            //if (IsPageAdmin())

            if (pAll.Visible)
            {
                var JSPath = HttpContext.Current.IsDebuggingEnabled
                           ? "~/DesktopModules/CLTools/js/CLTools.js"
                           : "~/DesktopModules/CLTools/js/CLTools.js";

                ClientResourceManager.RegisterScript(Page, JSPath);

                ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/CLTools/module.css", FileOrder.Css.ModuleCss);
                if (!Page.IsPostBack)
                {
                }
                CLControl1.BindAll(PortalSettings.ActiveTab.TabID);
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CLControl1.Visible = false;
            if ((Request.IsAuthenticated))
            {
                bool isAdmin = UserInfo.IsInRole(PortalSettings.AdministratorRoleName);
                if (isAdmin)
                {
                    CLControl1.Visible = true;
                }
            }

            var JSPath = HttpContext.Current.IsDebuggingEnabled
                       ? "~/DesktopModules/CLTools/js/CLTools.js"
                       : "~/DesktopModules/CLTools/js/CLTools.js";

            ClientResourceManager.RegisterScript(Page, JSPath);
            //ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/CLTools/module.css", FileOrder.Css.ModuleCss);
            //pAll.CssClass = "";
            if (!Page.IsPostBack)
            {
                TabController tc          = new TabController();
                string        CultureCode = LocaleController.Instance.GetCurrentLocale(PortalId).Code;
                var           Pages       = TabController.GetTabsBySortOrder(PortalSettings.PortalId, CultureCode, true).Where(t => !t.IsDeleted && t.ParentId != PortalSettings.AdminTabId && t.TabID != PortalSettings.AdminTabId);
                ddlPages.DataSource = Pages;
                ddlPages.DataBind();
                if (ddlPages.Items.Count > 0)
                {
                    //ddlPages_SelectedIndexChanged(null, null);
                    if (Request.QueryString["SelectedTabId"] != null)
                    {
                        string SelectedTabId = Request.QueryString["SelectedTabId"];
                        if (ddlPages.Items.FindByValue(SelectedTabId) != null)
                        {
                            ddlPages.SelectedValue = SelectedTabId;
                        }
                    }
                    CLControl1.BindAll(int.Parse(ddlPages.SelectedValue));
                }
                else
                {
                    CLControl1.Visible = false;
                }
            }
        }
        protected void BindCLControl()
        {
            NeutralMessage.Visible   = false;
            MakeTranslatable.Visible = false;
            MakeNeutral.Visible      = false;
            cmdUpdate.Visible        = false;
            AddMissing.Visible       = false;
            var tabInfo = ddlPages.SelectedPage;

            if (tabInfo != null)
            {
                if (String.IsNullOrEmpty(tabInfo.CultureCode))
                {
                    CLControl1.Visible = false;
                    if (UserInfo.IsSuperUser || UserInfo.IsInRole("Administrators"))
                    {
                        MakeTranslatable.Visible = true;
                    }
                    NeutralMessage.Visible = true;
                }
                else
                {
                    CLControl1.Visible        = true;
                    CLControl1.enablePageEdit = true;
                    CLControl1.BindAll(tabInfo.TabID);
                    cmdUpdate.Visible = true;

                    if (UserInfo.IsSuperUser || UserInfo.IsInRole("Administrators"))
                    {
                        // only show "Convert to neutral" if page has no child pages
                        MakeNeutral.Visible = (TabController.Instance.GetTabsByPortal(PortalId).WithParentId(tabInfo.TabID).Count == 0);

                        // only show "add missing languages" if not all languages are available
                        AddMissing.Visible = TabController.Instance.HasMissingLanguages(PortalId, tabInfo.TabID);
                    }
                }
            }
        }
 protected void cmdFix_Click(object sender, EventArgs e)
 {
     CLControl1.FixLocalizationErrors(ddlPages.SelectedPage.TabID);
     BindCLControl();
 }
 protected void cmdUpdate_Click(object sender, EventArgs e)
 {
     CLControl1.SaveData();
     BindCLControl();
 }