Example #1
0
 public AccountFriends(Account account)
     : base(account)
 {
     //RegisterSubModule += new RegisterSubModuleHandler(ManageFriends);
     //RegisterSubModule += new RegisterSubModuleHandler(InviteFriend);
     //RegisterSubModule += new RegisterSubModuleHandler(ManageFamily);
     //RegisterSubModule += new RegisterSubModuleHandler(ManageBlockList);
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="account"></param>
 public AccountGalleries(Account account)
     : base(account)
 {
     //RegisterSubModule += new RegisterSubModuleHandler(ManageGalleries);
     // TODO: Gallery Preferences
     //RegisterSubModule += new RegisterSubModuleHandler(UploadPhoto);
     //RegisterSubModule += new RegisterSubModuleHandler(NewGallery);
     //RegisterSubModule += new RegisterSubModuleHandler(MarkPhotoAsDisplayPicture);
     //RegisterSubModule += new RegisterSubModuleHandler(MarkPhotoAsGalleryCover);
     //RegisterSubModule += new RegisterSubModuleHandler(EditPhoto);
     //RegisterSubModule += new RegisterSubModuleHandler(RotatePhoto);
     //RegisterSubModule += new RegisterSubModuleHandler(PhotoDelete);
     //RegisterSubModule += new RegisterSubModuleHandler(PhotoTag);
 }
Example #3
0
 public AccountDashboard(Account account)
     : base(account)
 {
     // TODO: subscription management
 }
Example #4
0
 public AccountModule(Account account)
     : base(account)
 {
 }
        /// <summary>
        /// Bind the module to the account panel.
        /// </summary>
        /// <param name="account"></param>
        private void Bind(Account account)
        {
            account.RegisterModule += new Account.RegisterModuleHandler(RegisterModule);

            core = account.core;
            page = account.core.page;
            db = account.core.Db;
            loggedInMember = account.core.Session.LoggedInMember;
            tz = account.core.Tz;
            session = account.core.Session;
        }
Example #6
0
 public AccountNews(Account account)
     : base(account)
 {
 }
Example #7
0
 public AccountCalendar(Account account)
     : base(account)
 {
 }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string module = (!String.IsNullOrEmpty(Request.Form["module"])) ? Request.Form["module"] : Request.QueryString["module"];
            string submodule = (!String.IsNullOrEmpty(Request.Form["sub"])) ? Request.Form["sub"] : Request.QueryString["sub"];

            module = (module == null) ? "" : module;
            module = (module == "") ? "dashboard" : module;
            submodule = (submodule == null) ? "" : submodule;

            if (!session.IsLoggedIn)
            {
                SessionState.RedirectAuthenticate();
            }

            VariableCollection parentModulesVariableCollection = null;

            template.Parse("ACCOUNT_TITLE", core.Prose.GetString("GROUP_CONTROL_PANEL"));
            template.Parse("PRIMITIVE_TITLE", Group.DisplayName);
            template.Parse("U_PRIMITIVE", Group.Uri);

            template.Parse("IS_CONTENT", "FALSE");

            List<string[]> breadCrumbParts = new List<string[]>();
            breadCrumbParts.Add(new string[] { "account", core.Prose.GetString("GROUP_CONTROL_PANEL") });

            Owner.ParseBreadCrumbs(breadCrumbParts);

            Account accountObject = new Account(Core);
            loadModules(accountObject, BoxSocial.Internals.Application.GetModuleApplications(core, Group), module);

            accountObject.RegisterModule += new Account.RegisterModuleHandler(OnRegisterModule);
            accountObject.RegisterAllModules();

            accountModules.Sort();

            bool singleModule = false;
            if (!Group.IsGroupOperator(loggedInMember.ItemKey))
            {
                bool can = false;
                foreach (AccountSubModule asm in accountSubModules)
                {
                    if ((asm.Key == submodule || (string.IsNullOrEmpty(submodule) && asm.IsDefault)) && asm.ModuleKey == module)
                    {
                        if (asm is IPermissibleControlPanelSubModule)
                        {
                            IPermissibleControlPanelSubModule pasm = (IPermissibleControlPanelSubModule)asm;
                            can = pasm.Access.Can(pasm.AccessPermission);
                            singleModule = true;

                        }
                        break;
                    }
                }

                if (!can)
                {
                    core.Display.ShowMessage("Unauthorised", "You are unauthorised to manage this group.");
                }
            }

            foreach (AccountModule accountModule in accountModules)
            {
                if ((accountModule.Primitives & AppPrimitives.Group) == AppPrimitives.Group)
                {
                    if (singleModule && accountModule.Key != module)
                    {
                        continue;
                    }

                    VariableCollection modulesVariableCollection = template.CreateChild("module_list");

                    modulesVariableCollection.Parse("NAME", accountModule.Name);
                    if (!singleModule)
                    {
                        if (string.IsNullOrEmpty(accountModule.Key))
                        {
                            modulesVariableCollection.Parse("URI", Group.AccountUriStub);
                        }
                        else
                        {
                            modulesVariableCollection.Parse("URI", Group.AccountUriStub + accountModule.Key);
                        }
                    }

                    if (module == accountModule.Key)
                    {
                        ApplicationEntry ae = null;
                        if (accountModule.assembly.GetName().Name != "BoxSocial.Internals")
                        {
                            ae = core.GetApplication(accountModule.assembly.GetName().Name);
                        }

                        accountModule.SetOwner = Owner;
                        accountModule.CreateTemplate();
                        // catch all errors, don't want a single application to crash the account panel
                        try
                        {
                            accountModule.RegisterSubModules(submodule);
                            modules = accountModule.SubModules;
                            //accountModule.RenderTemplate();
                        }
                        catch (System.Threading.ThreadAbortException)
                        {
                            // ignore this informational exception
                        }
                        catch (Exception ex)
                        {
                            // TODO: e-mail application author of the error details
                            ///Response.Write("<hr />" + ex.ToString() + "<hr />");
                            accountModule.DisplayError("");

                            core.LoadUserProfile(ae.CreatorId);
                            core.Email.SendEmail(core.PrimitiveCache[ae.CreatorId].UserInfo.PrimaryEmail, "An Error occured in your application `" + ae.Title + "` at " + Hyperlink.Domain, ex.ToString());
                        }

                        modulesVariableCollection.Parse("CURRENT", "TRUE");
                        parentModulesVariableCollection = modulesVariableCollection;
                        if (ae != null && ae.HasJavascript)
                        {
                            VariableCollection javaScriptVariableCollection = template.CreateChild("javascript_list");

                            javaScriptVariableCollection.Parse("URI", @"/scripts/" + ae.Key + @".js");
                        }
                    }
                }
            }

            accountSubModules.Sort();

            foreach (AccountSubModule asm in accountSubModules)
            {
                if (!string.IsNullOrEmpty(asm.Key) && asm.Order >= 0)
                {
                    if (!singleModule)
                    {
                        VariableCollection modulesVariableCollection = template.CreateChild("account_links");
                        if (parentModulesVariableCollection != null)
                        {
                            parentModulesVariableCollection.CreateChild("account_links", modulesVariableCollection);
                        }

                        asm.SetOwner = Group;

                        modulesVariableCollection.Parse("TITLE", asm.Title);
                        modulesVariableCollection.Parse("SUB", asm.Key);
                        modulesVariableCollection.Parse("MODULE", asm.ModuleKey);
                        modulesVariableCollection.Parse("URI", asm.BuildUri(core));

                        if ((asm.Key == submodule || (string.IsNullOrEmpty(submodule) && asm.IsDefault)) && asm.ModuleKey == module)
                        {
                            modulesVariableCollection.Parse("CURRENT", "TRUE");
                        }
                    }
                }

                if ((asm.Key == submodule || (string.IsNullOrEmpty(submodule) && asm.IsDefault)) && asm.ModuleKey == module)
                {
                    asm.ModuleVector(core, Group, parentModulesVariableCollection);
                }
            }

            EndResponse();
        }
Example #9
0
        private void loadModulesFromAssembly(Account accountObject, Assembly assembly, string module)
        {
            Type[] types = assembly.GetTypes();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(typeof(AccountModule)))
                {
                    try
                    {
                        AccountModule newModule = System.Activator.CreateInstance(type, accountObject) as AccountModule;

                        if (newModule != null)
                        {
                            newModule.SetOwner = Owner;
                            newModule.assembly = assembly;
                            accountModules.Add(newModule);
                            if (newModule.Key == module)
                            {
                                core.AddPageAssembly(assembly);
                            }
                        }
                    }
                    catch (TargetInvocationException)
                    {
                        continue;
                    }
                }
            }
        }
 public ModeratorControlPanelModule(Account account)
     : base(account)
 {
 }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string module = (!String.IsNullOrEmpty(core.Http.Form["module"])) ? core.Http.Form["module"] : core.Http.Query["module"];
            string submodule = (!String.IsNullOrEmpty(core.Http.Form["sub"])) ? core.Http.Form["sub"] : core.Http.Query["sub"];

            module = (module == null) ? "" : module;
            module = (module == "") ? "dashboard" : module;
            submodule = (submodule == null) ? "" : submodule;

            List<string> args = new List<string>();

            if ((!session.IsLoggedIn) || loggedInMember == null)
            {
                foreach (string key in Request.QueryString.Keys)
                {
                    if (key != null)
                    {
                        if (key.ToLower() != "sid" && key.ToLower() != "module" && key.ToLower() != "sub")
                        {
                            args.Add(string.Format("{0}={1}", key, Request.QueryString[key]));
                        }
                    }
                }

                core.Http.Redirect(core.Hyperlink.BuildLoginUri(core.Hyperlink.StripSid(core.Hyperlink.BuildAccountSubModuleUri((Primitive)null, module, submodule, args.ToArray()))));
                return;
            }

            loggedInMember.LoadProfileInfo();

            template.Parse("ACCOUNT_TITLE", core.Prose.GetString("MY_ACCOUNT"));

            List<string[]> breadCrumbParts = new List<string[]>();
            breadCrumbParts.Add(new string[] { "account", core.Prose.GetString("MY_ACCOUNT") });

            ParseCoreBreadCrumbs(breadCrumbParts);

            if (!loggedInMember.UserInfo.ShowCustomStyles && !string.IsNullOrEmpty(loggedInMember.Style.RawCss))
            {
                template.ParseRaw("NO_CUSTOM_STYLE", "You have set a custom style for your site, yet you cannot view it as you have disabled custom styles. To view your custom style you must enable custom styles in your account <a href=\"/account/dashboard/preferences\">preferences</a>.");
            }

            Account accountObject = new Account(Core);
            loadModules(accountObject, BoxSocial.Internals.Application.GetModuleApplications(core, session.LoggedInMember), module);

            accountObject.RegisterModule += new Account.RegisterModuleHandler(OnRegisterModule);
            accountObject.RegisterAllModules();

            accountModules.Sort();

            VariableCollection parentModulesVariableCollection = null;

            ApplicationEntry ae = null;
            foreach (AccountModule accountModule in accountModules)
            {
                if ((accountModule.Primitives & AppPrimitives.Member) == AppPrimitives.Member)
                {
                    VariableCollection modulesVariableCollection = template.CreateChild("module_list");

                    modulesVariableCollection.Parse("NAME", accountModule.Name);
                    if (string.IsNullOrEmpty(accountModule.Key))
                    {
                        modulesVariableCollection.Parse("URI", core.Hyperlink.AppendSid(loggedInMember.AccountUriStub));
                    }
                    else
                    {
                        modulesVariableCollection.Parse("URI", core.Hyperlink.AppendSid(loggedInMember.AccountUriStub + accountModule.Key));
                    }

                    if (module == accountModule.Key)
                    {
                        if (accountModule.assembly.GetName().Name != "BoxSocial.Internals")
                        {
                            ae = core.GetApplication(accountModule.assembly.GetName().Name);
                        }

                        accountModule.SetOwner = loggedInMember;
                        accountModule.CreateTemplate();
                        // catch all errors, don't want a single application to crash the account panel
                        try
                        {
                            accountModule.RegisterSubModules(submodule);
                            modules = accountModule.SubModules;
                            //accountModule.RenderTemplate();
                        }
                        catch (System.Threading.ThreadAbortException)
                        {
                            // ignore this informational exception
                        }
                        catch (Exception ex)
                        {
                            // TODO: e-mail application author of the error details
                            accountModule.DisplayError("");

                            core.LoadUserProfile(ae.CreatorId);
                            core.Email.SendEmail(core.PrimitiveCache[ae.CreatorId].UserInfo.PrimaryEmail, "An Error occured in your application `" + ae.Title + "` at " + Hyperlink.Domain, ex.ToString());
                        }

                        modulesVariableCollection.Parse("CURRENT", "TRUE");
                        parentModulesVariableCollection = modulesVariableCollection;
                        if (ae != null && ae.HasJavascript)
                        {
                            //VariableCollection javaScriptVariableCollection = template.CreateChild("javascript_list");

                            //javaScriptVariableCollection.Parse("URI", @"/scripts/" + ae.Key + @".js");
                        }
                    }
                }
            }

            accountSubModules.Sort();

            bool orphan = true;

            foreach (AccountSubModule asm in accountSubModules)
            {
                if (!string.IsNullOrEmpty(asm.Key) && asm.Order >= 0)
                {
                    VariableCollection modulesVariableCollection = template.CreateChild("account_links");
                    if (parentModulesVariableCollection != null)
                    {
                        parentModulesVariableCollection.CreateChild("account_links", modulesVariableCollection);
                    }

                    asm.SetOwner = loggedInMember;

                    modulesVariableCollection.Parse("TITLE", asm.Title);
                    modulesVariableCollection.Parse("SUB", asm.Key);
                    modulesVariableCollection.Parse("MODULE", asm.ModuleKey);
                    modulesVariableCollection.Parse("URI", asm.BuildUri(core));

                    if ((asm.Key == submodule || (string.IsNullOrEmpty(submodule) && asm.IsDefault)) && asm.ModuleKey == module)
                    {
                        modulesVariableCollection.Parse("CURRENT", "TRUE");
                        orphan = false;
                    }
                }

                if ((asm.Key == submodule || (string.IsNullOrEmpty(submodule) && asm.IsDefault)) && asm.ModuleKey == module)
                {
                    //try
                    if (ae != null)
                    {
                        if (ae.HasStyleSheet)
                        {
                            VariableCollection styleSheetVariableCollection = core.Template.CreateChild("style_sheet_list");

                            styleSheetVariableCollection.Parse("URI", @"/styles/applications/" + ae.Key + @".css");
                        }

                        if (ae.HasJavascript)
                        {
                            VariableCollection javaScriptVariableCollection = core.Template.CreateChild("javascript_list");

                            javaScriptVariableCollection.Parse("URI", @"/scripts/" + ae.Key + @".js");
                        }
                    }
                    asm.ModuleVector(core, parentModulesVariableCollection);
                    /*catch (Exception ex)
                    {
                        throw new Exception(ex.ToString() + "\n\n\n" + db.ErrorList + "\n\n" + db.QueryList);
                    }*/
                }
            }

            if (orphan)
            {
                template.Parse("ORPHAN", "TRUE");
            }

            EndResponse();
        }
Example #12
0
 public AccountForum(Account account)
     : base(account)
 {
 }
Example #13
0
 public AccountPages(Account account)
     : base(account)
 {
 }
Example #14
0
 /// <summary>
 /// Initialises an account module.
 /// </summary>
 /// <remarks>Binds the module to the account panel, and registers
 /// the sub module registration handler.</remarks>
 /// <param name="account"></param>
 public ControlPanelModule(Account account)
     : base()
 {
     Bind(account);
 }
 public AccountEnterpriseResourcePlanning(Account account)
     : base(account)
 {
 }
Example #16
0
        private void loadModules(Account accountObject, List<ApplicationEntry> applicationsList, string module)
        {
            /*
             * Dashboard
             */
            Assembly dashboardAssembly = Assembly.GetAssembly(typeof(AccountDashboard));
            loadModulesFromAssembly(accountObject, dashboardAssembly, module);
            loadSubModulesFromAssembly(accountObject, dashboardAssembly, module);

            /*
             * Applications
             */
            foreach (ApplicationEntry ae in applicationsList)
            {
                if (ae.Modules != null && ae.Modules.Count > 0)
                {
                    string assemblyPath;
                    if (ae.IsPrimitive)
                    {
                        assemblyPath = Path.Combine(core.Http.AssemblyPath, string.Format("{0}.dll", ae.AssemblyName));
                    }
                    else
                    {
                        assemblyPath = Path.Combine(core.Http.AssemblyPath, Path.Combine("applications", string.Format("{0}.dll", ae.AssemblyName)));
                    }
                    Assembly assembly = BoxSocial.Internals.Application.LoadedAssemblies[ae.Id];

                    loadModulesFromAssembly(accountObject, assembly, module);
                    loadSubModulesFromAssembly(accountObject, assembly, module);
                }
            }
        }
Example #17
0
 public AccountMusician(Account account)
     : base(account)
 {
 }
Example #18
0
        private void loadSubModulesFromAssembly(Account accountObject, Assembly assembly, string module)
        {
            Type[] types = assembly.GetTypes();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(typeof(AccountSubModule)))
                {
                    AccountSubModule newModule = System.Activator.CreateInstance(type, new object[] { Core, (Primitive)Group }) as AccountSubModule;

                    if (newModule != null)
                    {
                        if (newModule.ModuleKey == module && (newModule.Primitives & AppPrimitives.Group) == AppPrimitives.Group)
                        {
                            accountSubModules.Add(newModule);
                        }
                    }
                }
            }
        }
        private void loadModulesFromAssembly(Account accountObject, Assembly assembly, string module)
        {
            Type[] types = assembly.GetTypes();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(typeof(AccountModule)))
                {
                    AccountModule newModule = System.Activator.CreateInstance(type, accountObject) as AccountModule;

                    if (newModule != null)
                    {
                        if ((newModule.Primitives & AnApplication.AppPrimitive) == AnApplication.AppPrimitive)
                        {
                            newModule.SetOwner = Owner;
                            newModule.assembly = assembly;
                            accountModules.Add(newModule);
                            if (newModule.Key == module)
                            {
                                core.AddPageAssembly(assembly);
                            }
                        }
                    }
                }
            }
        }
Example #20
0
 public AccountNetworks(Account account)
     : base(account)
 {
     //RegisterSubModule += new RegisterSubModuleHandler(ManageNetworkMemberships);
     //RegisterSubModule += new RegisterSubModuleHandler(JoinNetwork);
 }
Example #21
0
 /// <summary>
 /// Initialises a new instance of the AccountBlog class, which is an
 /// account module for the Blog application.
 /// </summary>
 /// <param name="account">The container account being initialised into.</param>
 public AccountBlog(Account account)
     : base(account)
 {
 }
Example #22
0
 public AccountProfile(Account account)
     : base(account)
 {
 }
 public AccountApplications(Account account)
     : base(account)
 {
 }
Example #24
0
 public AccountMail(Account account)
     : base(account)
 {
 }
Example #25
0
 public AccountGroups(Account account)
     : base(account)
 {
 }