protected void Page_Load(object sender, EventArgs e)
        {
            ((BasicTemplate)Master).Master
            .AddStaticStyles(GetStaticStyleSheet())
            .AddStaticBodyScripts(GetStaticJavaScript());

            LoadControls();

            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("files") &&
                !CoreContext.Configuration.Standalone &&
                !mobileAppRegistrator.IsInstallRegistered(currentUser.Email, MobileAppType.IosDocuments);

            if (CoreContext.Configuration.Personal)
            {
                PersonalProcess();
            }


            #region third-party scripts

            if (AddCustomScript)
            {
                using (var streamReader = new StreamReader(HttpContext.Current.Server.MapPath(PathProvider.GetFileControlPath("AnalyticsPersonalFirstVisit.js"))))
                {
                    var yaScriptText = streamReader.ReadToEnd();
                    Page.RegisterInlineScript(yaScriptText);
                }
            }

            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MyProjects = Page.RequestContext.CurrentUserProjects.ToList();

            InitControls();

            IsProjectAdmin = Page.Participant.IsAdmin;
            IsFullAdmin    = Page.Participant.IsFullAdmin;
            IsOutsider     = Page.Participant.UserInfo.IsOutsider();

            ParticipantSecurityInfo = new Dictionary <string, bool>
            {
                { "Project", IsProjectAdmin },
                { "Milestone", Page.RequestContext.CanCreateMilestone() },
                { "Task", Page.RequestContext.CanCreateTask() },
                { "Discussion", Page.RequestContext.CanCreateDiscussion() },
                { "Time", Page.RequestContext.CanCreateTime() },
                { "ProjectTemplate", IsProjectAdmin }
            };

            ShowCreateButton = (ParticipantSecurityInfo.Any(r => r.Value) || Page is TMDocs) && !Page.Participant.UserInfo.IsOutsider();


            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var isRegistered         = mobileAppRegistrator.IsInstallRegistered(currentUser.Email, null);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("projects") &&
                !CoreContext.Configuration.Standalone &&
                !isRegistered;
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ((BasicTemplate)Master).Master
            .AddStaticStyles(GetStaticStyleSheet())
            .AddStaticBodyScripts(GetStaticJavaScript());

            LoadControls();

            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("files") &&
                !CoreContext.Configuration.Standalone &&
                !mobileAppRegistrator.IsInstallRegistered(currentUser.Email, MobileAppType.IosDocuments);

            if (CoreContext.Configuration.Personal)
            {
                PersonalProcess();
            }


            #region third-party scripts

            if (AddCustomScript && (string)Session["campaign"] == "personal")
            {
                Session["campaign"] = "";

                var GoogleConversionScriptLocation = PathProvider.GetFileControlPath("GoogleConversionScript.ascx");
                if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(GoogleConversionScriptLocation)))
                {
                    ThirdPartyScriptsPlaceHolder.Controls.Add(LoadControl(GoogleConversionScriptLocation));
                }
                else
                {
                    ThirdPartyScriptsPlaceHolder.Visible = false;
                }
            }
            else
            {
                ThirdPartyScriptsPlaceHolder.Visible = false;
            }

            if (AddCustomScript)
            {
                var YandexScriptLocation = PathProvider.GetFileControlPath("YandexScript.js");
                if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(YandexScriptLocation)))
                {
                    var    streamReader = new System.IO.StreamReader(HttpContext.Current.Server.MapPath(YandexScriptLocation));
                    string yaScriptText = streamReader.ReadToEnd();
                    streamReader.Close();

                    Page.RegisterInlineScript(yaScriptText);
                }
            }

            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadScripts();

            LoadControls();

            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var isRegistered         = mobileAppRegistrator.IsInstallRegistered(currentUser.Email, null);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("files") &&
                !CoreContext.Configuration.Standalone &&
                !isRegistered;

            if (CoreContext.Configuration.Personal)
            {
                PersonalProcess();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            MyProjects = Page.RequestContext.CurrentUserProjects.ToList();

            InitControls();

            IsProjectAdmin   = Page.ProjectSecurity.CurrentUserAdministrator;
            IsFullAdmin      = Page.Participant.IsFullAdmin;
            IsOutsider       = Page.Participant.UserInfo.IsOutsider();
            ShowCreateButton = !Page.Participant.UserInfo.IsOutsider();


            var mobileAppRegistrator = new CachedMobileAppInstallRegistrator(new MobileAppInstallRegistrator());
            var currentUser          = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            var isRegistered         = mobileAppRegistrator.IsInstallRegistered(currentUser.Email, null);

            DisplayAppsBanner =
                SetupInfo.DisplayMobappBanner("projects") &&
                !CoreContext.Configuration.Standalone &&
                !isRegistered;
        }
        private void LoadControls()
        {
            if (Desktop)
            {
                Master.Master.DisabledTopStudioPanel = true;
                Master.Master.EnabledWebChat         = false;
            }

            var enableThirdParty = ThirdpartyConfiguration.SupportInclusion &&
                                   !CurrentUser.IsVisitor() &&
                                   (Classes.Global.IsAdministrator ||
                                    FilesSettings.EnableThirdParty ||
                                    CoreContext.Configuration.Personal) &&
                                   !Desktop;

            CreateButtonHolder.Controls.Add(LoadControl(MainButton.Location));

            var mainMenu = (MainMenu)LoadControl(MainMenu.Location);

            mainMenu.EnableThirdParty = enableThirdParty;
            mainMenu.Desktop          = Desktop;
            CommonSideHolder.Controls.Add(mainMenu);

            if (Request.SailfishApp())
            {
                CommonContainerHolder.Controls.Add(LoadControl(Sailfish.Location));
            }

            FilterHolder.Controls.Add(LoadControl(MainContentFilter.Location));

            var mainContent = (MainContent)LoadControl(MainContent.Location);

            mainContent.TitlePage = FilesCommonResource.TitlePage;
            CommonContainerHolder.Controls.Add(mainContent);

            if (CoreContext.Configuration.Personal &&
                !Desktop)
            {
                CommonContainerHolder.Controls.Add(LoadControl(MoreFeatures.Location));
            }

            CommonContainerHolder.Controls.Add(LoadControl(AccessRights.Location));

            loaderHolder.Controls.Add(LoadControl(LoaderPage.Location));

            if (enableThirdParty)
            {
                SettingPanelHolder.Controls.Add(LoadControl(Files.Controls.ThirdParty.Location));
            }

            if (Desktop)
            {
                CommonContainerHolder.Controls.Add(LoadControl(Files.Controls.Desktop.Location));
            }

            if (!Desktop &&
                SetupInfo.DisplayMobappBanner("files"))
            {
                AppBannerHolder.Controls.Add(LoadControl(AppBanner.Location));
            }
        }