Beispiel #1
0
 protected static void ApplicationStartup(object sender, ActiveEventArgs e)
 {
     // Must do this just in case we've got "dead references" laying around ...
     Users.Instance.Clear();
     Language.Instance.SetDefaultValue("ButtonAdmin", "Admin");
     Language.Instance.SetDefaultValue("ButtonAppl", "Applications");
 }
 protected void SaveTwitterUsernameAndPassword(object sender, ActiveEventArgs e)
 {
     string username = e.Params["Username"].Get<string>();
     string password = e.Params["Password"].Get<string>();
     UserSettings.Instance["TwitterUsername", Users.LoggedInUserName] = username;
     UserSettings.Instance["TwitterPassword", Users.LoggedInUserName] = password;
 }
 protected void GetMenuItems(object sender, ActiveEventArgs e)
 {
     e.Params["ButtonAppl"].Value = "Menu-Applications";
     e.Params["ButtonAppl"]["ButtonChat"].Value = "Menu-Applications-Chat";
     e.Params["ButtonAppl"]["ButtonChat"]["ButtonAvailableUsers"].Value = "Menu-OpenChat";
     e.Params["ButtonAppl"]["ButtonChat"]["ButtonViewHistory"].Value = "Menu-OpenChatHistory";
 }
        protected void Page_Init_InitialLoading(object sender, ActiveEventArgs e)
        {
            Page page = HttpContext.Current.Handler as Page;

            // Injecting a CSS link reference if additional CSS files are to be included
            string custFiles = Settings.Instance["CustomCssFiles"];
            if (!string.IsNullOrEmpty(custFiles))
            {
                string[] files = custFiles.Split(
                    new char[] { ',' }, 
                    StringSplitOptions.RemoveEmptyEntries);
                foreach (string file in files)
                {
                    string fileName = file.Trim();
                    LiteralControl lit = new LiteralControl();
                    lit.Text = string.Format(@"
<link 
    href=""{0}"" 
    rel=""stylesheet""
    type=""text/css"" />",
                             fileName);
                    page.Header.Controls.Add(lit);
                }
            }
        }
Beispiel #5
0
 protected void InitialLoadingOfPage(object sender, ActiveEventArgs e)
 {
     if (HttpContext.Current.Request.Params["message"] != null)
     {
         string msgId = HttpContext.Current.Request.Params["message"];
         string msg = Language.Instance[msgId];
         Node nodeMessage = new Node();
         nodeMessage["Message"].Value = msg;
         nodeMessage["Duration"].Value = 2000;
         ActiveEvents.Instance.RaiseActiveEvent(
             this,
             "ShowInformationMessage",
             nodeMessage);
     }
     LoadMenu();
     if (!string.IsNullOrEmpty(Users.LoggedInUserName))
     {
         Node node = new Node();
         node["AddToExistingCollection"].Value = true;
         node["ModuleSettings"]["Username"].Value = Users.LoggedInUserName;
         ActiveEvents.Instance.RaiseLoadControl(
             "LoginOpenIDModules.Logout",
             "dynTop",
             node);
     }
     else
     {
         LoadLoginModule();
     }
 }
 protected static void DefaultCMSContentCreated(object sender, ActiveEventArgs e)
 {
     AccessEntity a = new AccessEntity();
     a.MenuValue = "url:~/";
     a.RoleName = "Everyone";
     a.Save();
 }
        protected void CheckAccessToMenuItem(object sender, ActiveEventArgs e)
        {
            _accessEntities = new List<AccessEntity>(ActiveType<AccessEntity>.Select(Criteria.Eq("MenuValue", e.Params["MenuValue"].Value)));

            User current = null;
            if (!string.IsNullOrEmpty(Users.LoggedInUserName))
            {
                current = ActiveType<User>.SelectFirst(Criteria.Eq("Username", Users.LoggedInUserName));
            }

            bool hasAccess;
            if (current == null)
            {
                hasAccess = _accessEntities.Exists(
                    delegate(AccessEntity idx)
                        {
                            return idx.RoleName == "Everyone";
                        });
            }
            else
            {
                hasAccess = current.InRole("Administrator") || _accessEntities.Exists(
                    delegate(AccessEntity idx)
                        {
                            return idx.RoleName == "Everyone" || current.InRole(idx.RoleName);
                        });
            }

            // Returning access back...
            e.Params["DeniedAccess"].Value = !hasAccess;
        }
        protected void ViewDetailsOfApplicationFile(object sender, ActiveEventArgs e)
        {
            string fileFullPath = e.Params["FileFullPath"].Get<string>();
            if (fileFullPath.IndexOf(".dll") != -1)
            {
                ReflectionHelper helper = new ReflectionHelper(fileFullPath);
                Node node = helper.CreateNodeStructure();
                Node input = new Node();
                input["ModuleSettings"].Add(node[0]);
                input["ModuleSettings"]["FileFullPath"].Value = fileFullPath;
                ActiveEvents.Instance.RaiseLoadControl(
                    "InstalledAppsModules.ViewDetailsOfFile",
                    "dynMin",
                    input);
            }
            else
            {
                Node node = new Node();
                node["Message"].Value =
                    Language.Instance["CannotViewNonDll", null, @"
You cannot view the details of a non-DLL file..."];
                node["Duration"].Value = 5000;
                ActiveEvents.Instance.RaiseActiveEvent(
                    this,
                    "ShowInformationMessage",
                    node);
            }
        }
        protected static void Page_Init(object sender, ActiveEventArgs e)
        {
            Page page = HttpContext.Current.Handler as Page;
            if (page != null)
            {
                if(!page.IsPostBack)
                {
                    // Inject the Google Analytics tracking code...
                    string trackingID = Settings.Instance["GoogleAnalyticsTrackingID"];
                    if(!string.IsNullOrEmpty(trackingID))
                    {
                        string trackingCode = string.Format(@"
<script type=""text/javascript"">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{0}']);
_gaq.push(['_trackPageview']);
(function() {{
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
    'https://ssl' : 'http://www') +
    '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
}})();
</script>", trackingID);
                        LiteralControl ctrl = new LiteralControl();
                        ctrl.Text = trackingCode;
                        page.Form.Controls.Add(ctrl);
                    }
                }
            }
        }
 protected static void ApplicationStartup2(object sender, ActiveEventArgs e)
 {
     Language.Instance.SetDefaultValue("ButtonSkins", "Skins");
     Language.Instance.SetDefaultValue("ButtonChangeSkin", "Change Skin");
     Language.Instance.SetDefaultValue("ButtonDefaultSkin", "Set Default Skin");
     Language.Instance.SetDefaultValue("ButtonUploadNewSkin", "Upload New Skin");
 }
 protected void GetMenuItems(object sender, ActiveEventArgs e)
 {
     e.Params["ButtonAdmin"]["ButtonSkins"].Value = "Menu-SkinRootFolder";
     e.Params["ButtonAdmin"]["ButtonSkins"]["ButtonChangeSkin"].Value = "Menu-ChangeSkin";
     e.Params["ButtonAdmin"]["ButtonSkins"]["ButtonDefaultSkin"].Value = "Menu-DefaultSkin";
     e.Params["ButtonAdmin"]["ButtonSkins"]["ButtonUploadNewSkin"].Value = "Menu-UploadNewSkin";
 }
        protected void CMSCommonPluginsSendEmail(object sender, ActiveEventArgs e)
        {
            string smtpServer = Settings.Instance["SMTPServer"];
            string smtpServerUsername = Settings.Instance["SMTPServerUsername"];
            string smtpServerPassword = Settings.Instance["SMTPServerPassword"];
            string smtpServerUseSsl = Settings.Instance["SMTPServerUseSsl"];
            string adminEmail = Settings.Instance["AdminEmail"];
            MailMessage msg = new MailMessage();
            msg.To.Add(adminEmail);
            msg.From = new MailAddress("*****@*****.**");
            msg.Subject = Language.Instance["EmailDefaultSubjectLine", null, "Comment from: "] + e.Params["Name"].Get<string>();
            msg.Body = 
                Language.Instance["ContactCredentials", null, "Contact credentials: "] + 
                e.Params["Email"].Get<string>() + 
                ". " + 
                e.Params["Comment"].Get<string>()
                + @"

Promo Code: " + HttpContext.Current.Session["PromoCode"];
            msg.IsBodyHtml = false;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = smtpServer;
            smtp.Credentials = new NetworkCredential(smtpServerUsername, smtpServerPassword);
            smtp.EnableSsl = smtpServerUseSsl == "True";
            smtp.Send(msg);
        }
 protected void GetMenuItems(object sender, ActiveEventArgs e)
 {
     GetClassesMenuItems(e);
     e.Params["ButtonDocumentation"].Value = "Menu-ViewDocumentation";
     if (_tutorials.Count == 0)
     {
         string root = HttpContext.Current.Server.MapPath("~/");
         if (Directory.Exists(root + "tutorials"))
         {
             foreach (string fileName in Directory.GetFiles(root + "tutorials/", "*.txt"))
             {
                 string[] tmpSplits = fileName.Split('-');
                 string tutorialName = tmpSplits[tmpSplits.Length - 1].Replace(".txt", "").Trim();
                 string tutorialUrl = tutorialName.Replace(" ", "-");
                 _tutorials[tutorialName] = "url:~/tutorials/" +
                     tutorialUrl.ToLower() +
                     ConfigurationManager.AppSettings["DefaultPageExtension"];
             }
         }
         else
         {
             _hasTutorials = false;
         }
     }
     if (_hasTutorials)
     {
         e.Params["ButtonTutorials"].Value = "tutorials";
         foreach (string idxKey in _tutorials.Keys)
         {
             e.Params["ButtonTutorials"][idxKey].Value = _tutorials[idxKey];
         }
     }
 }
 protected void ChangeUserLanguage(object sender, ActiveEventArgs e)
 {
     string language = e.Params["Language"].Get<string>();
     Language.Instance.UserLanguage = language;
     UserSettings.Instance["Language", Users.LoggedInUserName] = language;
     AjaxManager.Instance.Redirect("~/?message=LanguageChanged");
 }
 protected void ViewRSS(object sender, ActiveEventArgs e)
 {
     Node node = new Node();
     node["TabCaption"].Value = Language.Instance["NewsFromTheWorld", null, "News from the world"];
     int idxNo = 0;
     foreach (Rss idx in RssDatabase.Database)
     {
         node["ModuleSettings"]["Items"]["Item" + idxNo]["Caption"].Value = idx.Title;
         node["ModuleSettings"]["Items"]["Item" + idxNo]["Link"].Value = idx.WebLink;
         node["ModuleSettings"]["Items"]["Item" + idxNo]["ID"].Value = idx.Id;
         int idxNoItem = 0;
         foreach (RssItem idxItem in idx.Items)
         {
             node["ModuleSettings"]["Items"]["Item" + idxNo]["Items"]["Item" + idxNoItem]["Caption"].Value = idxItem.Header;
             node["ModuleSettings"]["Items"]["Item" + idxNo]["Items"]["Item" + idxNoItem]["Body"].Value = idxItem.Body;
             node["ModuleSettings"]["Items"]["Item" + idxNo]["Items"]["Item" + idxNoItem]["Date"].Value = idxItem.Date;
             node["ModuleSettings"]["Items"]["Item" + idxNo]["Items"]["Item" + idxNoItem]["URL"].Value = idxItem.Url;
             idxNoItem += 1;
         }
         idxNo += 1;
     }
     ActiveEvents.Instance.RaiseLoadControl(
         "RssReaderModules.ViewRSSItems",
         "dynMid",
         node);
 }
Beispiel #16
0
 protected static void ApplicationStartup2(object sender, ActiveEventArgs e)
 {
     Language.Instance.SetDefaultValue("ButtonUsers", "Users");
     Language.Instance.SetDefaultValue("ButtonViewAllUsers", "View All");
     Language.Instance.SetDefaultValue("ButtonCreateNewUser", "Create New");
     Language.Instance.SetDefaultValue("ButtonEditMyUser", "Edit Profile");
 }
        protected void GetMenuItems(object sender, ActiveEventArgs e)
        {
            e.Params["ButtonAppl"]["ButtonLists"].Value = "Menu-Whiteboards";
            e.Params["ButtonAppl"]["ButtonLists"]["ButtonCreateNewList"].Value = "Menu-CreateWhiteboard";

            List<Whiteboard> whiteboards = new List<Whiteboard>(ActiveType<Whiteboard>.Select());
            if (whiteboards.Count > 0)
            {
                e.Params["ButtonAppl"]["ButtonLists"]["ButtonViewAllLists"].Value = "Menu-ViewAllWhiteboards";
                e.Params["ButtonAppl"]["ButtonLists"]["ButtonEditList"].Value = "Menu-EditWhiteboard";
                e.Params["ButtonAppl"]["ButtonLists"]["ButtonViewList"].Value = "Menu-ViewWhiteboard";
                foreach (Whiteboard idx in whiteboards)
                {
                    // First the edit parts...
                    e.Params["ButtonAppl"]["ButtonLists"]["ButtonEditList"]
                        [Language.Instance["Edit", null, "Edit"] + " " + idx.Name].Value = "Menu-EditSpecificWhiteboard";
                    e.Params["ButtonAppl"]["ButtonLists"]["ButtonEditList"]
                        [Language.Instance["Edit", null, "Edit"] + " " + idx.Name]["Params"].Value = idx.ID.ToString();

                    // Then the "view" parts
                    e.Params["ButtonAppl"]["ButtonLists"]["ButtonViewList"]
                        [Language.Instance["View", null, "View"] + " " + idx.Name].Value = "Menu-ViewSpecificWhiteboard";
                    e.Params["ButtonAppl"]["ButtonLists"]["ButtonViewList"]
                        [Language.Instance["View", null, "View"] + " " + idx.Name]["Params"].Value = idx.ID.ToString();
                }
            }
        }
Beispiel #18
0
 protected void GetMenuItems(object sender, ActiveEventArgs e)
 {
     e.Params["ButtonAdmin"]["ButtonRoles"].Value = "Menu-AdministrateRoles";
     e.Params["ButtonAdmin"]["ButtonRoles"]["ButtonViewAllRoles"].Value = "Menu-ViewAllRoles";
     e.Params["ButtonAdmin"]["ButtonRoles"]["ButtonCreateRole"].Value = "Menu-CreateRole";
     e.Params["ButtonAdmin"]["ButtonRoles"]["ButtonAccessControl"].Value = "Menu-AccessControl";
 }
        protected void ViewPromoters(object sender, ActiveEventArgs e)
        {
            Node node = new Node();

            // Columns...
            node["ModuleSettings"]["Grid"]["Columns"]["Email"]["Caption"].Value = Language.Instance["Email", null, "Email"];
            node["ModuleSettings"]["Grid"]["Columns"]["Email"]["ControlType"].Value = "Label";

            node["ModuleSettings"]["Grid"]["Columns"]["Code"]["Caption"].Value = Language.Instance["PromoCodeGridHeader", null, "Promo Code"];
            node["ModuleSettings"]["Grid"]["Columns"]["Code"]["ControlType"].Value = "Label";

            node["ModuleSettings"]["Grid"]["Columns"]["Cause"]["Caption"].Value = Language.Instance["PromoCodeCauseHeader", null, "Cause"];
            node["ModuleSettings"]["Grid"]["Columns"]["Cause"]["ControlType"].Value = "Label";

            node["ModuleSettings"]["Grid"]["Columns"]["Address"]["Caption"].Value = Language.Instance["Address", null, "Address"];
            node["ModuleSettings"]["Grid"]["Columns"]["Address"]["ControlType"].Value = "Label";
            foreach (PromoCode idx in PromoCode.Select())
            {
                node["ModuleSettings"]["Grid"]["Rows"]["Row" + idx.ID]["Email"].Value = idx.Email;
                node["ModuleSettings"]["Grid"]["Rows"]["Row" + idx.ID]["Code"].Value = idx.Code;
                node["ModuleSettings"]["Grid"]["Rows"]["Row" + idx.ID]["Cause"].Value = idx.Cause;
                node["ModuleSettings"]["Grid"]["Rows"]["Row" + idx.ID]["Address"].Value = idx.Address;
            }
            ActiveEvents.Instance.RaiseLoadControl(
                "PromoModules.ViewPromoters",
                "dynMid",
                node);
        }
Beispiel #20
0
        protected static void ApplicationStartup(object sender, ActiveEventArgs e)
        {
            // Checking to see if our default roles exists, and if not we create them...
            if (ActiveType<Role>.Count == 0)
            {
                // Creating default roles
                Role admin = new Role {Name = "Administrator"};
                admin.Save();

                Role user = new Role {Name = "User"};
                user.Save();

                Role view = new Role {Name = "View"};
                view.Save();

                Role blocked = new Role {Name = "Blocked"};
                blocked.Save();

                Role noRole = new Role {Name = "Everyone"};
                noRole.Save();
            }

            // Settings default language values for module...
            Language.Instance.SetDefaultValue("ButtonRoles", "Roles");
            Language.Instance.SetDefaultValue("ButtonViewAllRoles", "View All Roles");
            Language.Instance.SetDefaultValue("ButtonCreateRole", "Create Role");
            Language.Instance.SetDefaultValue("ButtonAccessControl", "Access Control");
        }
        protected void EditUserSettings(object sender, ActiveEventArgs e)
        {
            Node node = new Node();
            node["TabCaption"].Value = "Settings";

            node["ModuleSettings"]["DeleteEventName"].Value = "UserSettingDeleted";
            node["ModuleSettings"]["EditEventName"].Value = "UserSettingEdited";

            // Columns...
            node["ModuleSettings"]["Grid"]["Columns"]["Key"]["Caption"].Value = Language.Instance["SettingsKeyButton", null, "Key"];
            node["ModuleSettings"]["Grid"]["Columns"]["Key"]["ControlType"].Value = "Label";

            node["ModuleSettings"]["Grid"]["Columns"]["Value"]["Caption"].Value = Language.Instance["SettingsValueButton", null, "Value"];
            node["ModuleSettings"]["Grid"]["Columns"]["Value"]["ControlType"].Value = "InPlaceEdit";

            int idxNo = 0;
            foreach (UserSettings.Setting idx in UserSettings.Instance)
            {
                if (idx.Username == Users.LoggedInUserName)
                {
                    node["ModuleSettings"]["Grid"]["Rows"]["Row" + idxNo]["ID"].Value = idx.ID;
                    node["ModuleSettings"]["Grid"]["Rows"]["Row" + idxNo]["Key"].Value = idx.Name;
                    node["ModuleSettings"]["Grid"]["Rows"]["Row" + idxNo]["Value"].Value = idx.Value;
                    idxNo += 1;
                }
            }

            ActiveEvents.Instance.RaiseLoadControl(
                "SettingsModules.ViewSettings",
                "dynMid",
                node);
        }
 protected void GetGridColumnType(object sender, ActiveEventArgs e)
 {
     string controlType = e.Params["ColumnType"].Get<string>();
     if (controlType == "Boolean")
     {
         CreateBoolean(e);
     }
     else if (controlType == "Color")
     {
         CreateColor(e);
     }
     else if (controlType == "User")
     {
         CreateUser(e);
     }
     else if (controlType == "Strike")
     {
         CreateStrike(e);
     }
     else if (controlType == "Date")
     {
         CreateDate(e);
     }
     else if (controlType == "ViewDetails")
     {
         CreateViewDetails(e);
     }
 }
 protected void ImageFileChosenByFileDialog(object sender, ActiveEventArgs e)
 {
     string fileName = e.Params["File"].Get<string>();
     string html = string.Format(
         @"<img src=""{0}"" alt=""unknown"" />", fileName);
     editor.PasteHTML(html);
 }
 protected static void ApplicationStartup(object sender, ActiveEventArgs e)
 {
     Language.Instance.SetDefaultValue("ButtonCandyStore", "Bazaar");
     Language.Instance.SetDefaultValue("ButtonVisitBazaar", "Visit Bazaar");
     Language.Instance.SetDefaultValue("ButtonInstalledApps", "Manage Apps");
     Language.Instance.SetDefaultValue("ButtonViewInstalledApps", "View Apps");
     Language.Instance.SetDefaultValue("ButtonInstallNewApp", "Install App");
 }
 protected static void ApplicationStartup(object sender, ActiveEventArgs e)
 {
     Language.Instance.SetDefaultValue("ButtonAdmin", "Admin");
     Language.Instance.SetDefaultValue("ButtonRoles", "Roles");
     Language.Instance.SetDefaultValue("ButtonADMappings", "AD-Mappings");
     Language.Instance.SetDefaultValue("ButtonShowADMappings", "View Mappings");
     Language.Instance.SetDefaultValue("ButtonCreateADMapping", "Create New");
 }
 protected static void ApplicationStartup(object sender, ActiveEventArgs e)
 {
     Language.Instance.SetDefaultValue("ButtonLists", "Lists");
     Language.Instance.SetDefaultValue("ButtonCreateNewList", "New List");
     Language.Instance.SetDefaultValue("ButtonViewAllLists", "View All");
     Language.Instance.SetDefaultValue("ButtonEditList", "Configure");
     Language.Instance.SetDefaultValue("ButtonViewList", "View");
 }
 protected void GetGridColumnType(object sender, ActiveEventArgs e)
 {
     string controlType = e.Params["ColumnType"].Get<string>();
     if (controlType == "ToPDF")
     {
         CreateToPDF(e);
     }
 }
 protected void CMSInsertLink(object sender, ActiveEventArgs e)
 {
     string html = string.Format(
         @"<a href=""{0}"">{1}</a>", 
         e.Params["URL"].Get<string>(),
         e.Params["Text"].Get<string>());
     editor.PasteHTML(html);
 }
        protected static void GetTipOfToday(object sender, ActiveEventArgs e)
        {
            const string tmp = @"
You can export languages once you have translated the portal, these languages can then
be imported into either other installations or kept as backups for the future.
";
            e.Params["Tip"]["TipOfExportLanguage"].Value = Language.Instance["TipOfExportLanguage", null, tmp];
        }
 protected void ImportRSSIntoArticles(object sender, ActiveEventArgs e)
 {
     Node node = new Node();
     node["Caption"].Value = Language.Instance["ImportRSS", null, "Import RSS"];
     ActiveEvents.Instance.RaiseLoadControl(
         "ArticlePublisherModules.ImportRSS",
         "dynPopup",
         node);
 }