Example #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            try
            {
                var tabId         = -1;
                var forumModuleId = -1;

                if (!string.IsNullOrWhiteSpace(ddlAFInstance.SelectedValue))
                {
                    var selectedIDArray = ddlAFInstance.SelectedValue.Split('|');
                    tabId         = int.Parse(selectedIDArray[0]);
                    forumModuleId = int.Parse(selectedIDArray[1]);
                }

                var mc = new ModuleController();

                var moduleSettings = mc.GetModuleSettings(ModuleId);
                var settings       = ActiveForumsTapatalkModuleSettings.Create(moduleSettings);

                settings.IsOpen                     = ckEnabled.Checked;
                settings.ForumTabId                 = tabId;
                settings.ForumModuleId              = forumModuleId;
                settings.AllowAnonymous             = ckAllowAnonymous.Checked;
                settings.RegistrationUrl            = txtRegistrationPage.Text.Trim();
                settings.SearchPermission           = (ActiveForumsTapatalkModuleSettings.SearchPermissions) int.Parse(ddlSearchPermission.SelectedValue);
                settings.IsTapatalkDetectionEnabled = ckEnableTapatalkDetection.Checked;

                settings.Save(mc, ModuleId);
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Example #2
0
        private void CheckConfig(ActiveForumsTapatalkModuleSettings settings)
        {
            if (settings.ForumModuleId >= 0 && settings.ForumTabId >= 0)
            {
                return;
            }

            tapatalkConfigWarning.Visible   = true;
            tapatalkConfigWarning.InnerText = LocalizeString("ConfigWarning");
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            tapatalkConfigWarning.Visible = false;

            var settings = ActiveForumsTapatalkModuleSettings.Create(Settings);

            if (Globals.IsEditMode())
            {
                CheckConfig(settings);
            }

            const string tapatalkDetectionKey = "TapatalkDetection";

            if (!Globals.IsEditMode() && settings.IsTapatalkDetectionEnabled && !Page.ClientScript.IsClientScriptIncludeRegistered(tapatalkDetectionKey))
            {
                Framework.jQuery.RequestRegistration();
                Page.ClientScript.RegisterClientScriptInclude(tapatalkDetectionKey, Page.ResolveUrl("~/DesktopModules/ActiveForumsTapatalk/tapatalkdetect.js"));
            }
        }
Example #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LoadSettings loads the settings from the Database and displays them
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void LoadSettings()
        {
            try
            {
                if (Page.IsPostBack == false)
                {
                    var moduleSettings = new ModuleController().GetModuleSettings(ModuleId);
                    var settings       = ActiveForumsTapatalkModuleSettings.Create(moduleSettings);

                    // Bind the Simple Settings
                    ckEnabled.Checked        = settings.IsOpen;
                    ckAllowAnonymous.Checked = settings.AllowAnonymous;
                    txtRegistrationPage.Text = settings.RegistrationUrl;

                    // Bind Active Forum Instances
                    ddlAFInstance.Items.Clear();
                    ddlAFInstance.ClearSelection();

                    ckEnableTapatalkDetection.Checked = settings.IsTapatalkDetectionEnabled;

                    ddlSearchPermission.ClearSelection();
                    var searchPermissionItem = ddlSearchPermission.Items.FindByValue(((int)settings.SearchPermission).ToString());
                    if (searchPermissionItem != null)
                    {
                        searchPermissionItem.Selected = true;
                    }

                    var mc = new ModuleController();
                    var tc = new TabController();

                    var selectedValue = string.Format("{0}|{1}", settings.ForumTabId, settings.ForumModuleId);

                    foreach (ModuleInfo mi in mc.GetModulesByDefinition(PortalId, "Active Forums"))
                    {
                        if (mi.IsDeleted)
                        {
                            continue;
                        }

                        var ti = tc.GetTab(mi.TabID, PortalId, false);
                        if (ti != null && !ti.IsDeleted)
                        {
                            var itemValue = string.Format("{0}|{1}", ti.TabID, mi.ModuleID);
                            ddlAFInstance.Items.Add(new ListItem
                            {
                                Text     = ti.TabName + " - " + mi.DesktopModule.ModuleName,
                                Value    = ti.TabID + "|" + mi.ModuleID,
                                Selected = itemValue == selectedValue
                            });
                        }
                    }

                    // Bind the Tapatalk.Com info
                    txtForumUrl.Text = string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Host);
                    txtInstallationDirectoryName.Text = string.Format("aft{0}", ModuleId);
                    txtFileExtension.Text             = "ashx";

                    // Bind the Tapatalk API Handler
                    var isTapatalkAPIHandlerEnabled = IsTapatalkAPIHandlerEnabled();

                    ckEnabled.Enabled     = isTapatalkAPIHandlerEnabled;
                    lbInstallHandler.Text =
                        LocalizeString(isTapatalkAPIHandlerEnabled
                                           ? "UninstallTapatalkAPIHandler"
                                           : "InstallTapatalkAPIHandler");

                    var u = UserController.GetCurrentUserInfo();
                    lbInstallHandler.Enabled = u.IsSuperUser && !PortalSettings.PortalAlias.HTTPAlias.Contains("/");
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }