Example #1
0
        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
            ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary<string, object>();
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
                GridNewsItem item = new GridNewsItem {Text = text, Time = DateTime.Now, Title = title};
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                response = "<h3>News item added successfully, redirecting to main page</h3>" +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                           "</script>";
                return null;
            }

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return vars;
        }
Example #2
0
        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary<string, object>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridNewsItem news;
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                string id = requestParameters["NewsID"].ToString();
                news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", id);
                connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
                GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) };
                connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
                vars["ErrorMessage"] = "News item edit successfully";
                webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
                return vars;
            }
            else
                vars["ErrorMessage"] = "";


            news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            vars.Add("NewsTitle", news.Title);
            vars.Add("NewsText", news.Text);
            vars.Add("NewsID", news.ID.ToString());

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            return vars;
        }
Example #3
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>();
            GridNewsItem       news      = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());

            if (news != null)
            {
                vars.Add("NewsTitle", news.Title);
                vars.Add("NewsText", news.Text);
                vars.Add("NewsID", news.ID.ToString());
            }
            else
            {
                if (httpRequest.Query["newsid"].ToString() == "-1")
                {
                    vars.Add("NewsTitle", "No news to report");
                    vars.Add("NewsText", "");
                }
                else
                {
                    vars.Add("NewsTitle", "Invalid News Item");
                    vars.Add("NewsText", "");
                }
                vars.Add("NewsID", "-1");
            }

            vars.Add("News", translator.GetTranslatedString("News"));
            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            return(vars);
        }
Example #4
0
        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary<string, object>();
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
                GridNewsItem item = new GridNewsItem { Text = text, Time = DateTime.Now, Title = title };
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                vars["ErrorMessage"] = "News item added successfully";
                webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
                return vars;
            }
            else
                vars["ErrorMessage"] = "";

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return vars;
        }
Example #5
0
        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary<string, object>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridNewsItem news;
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                string id = requestParameters["NewsID"].ToString();
                news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", id);
                connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
                GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) };
                connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
                response = "<h3>News item editted successfully, redirecting to main page</h3>" +
                    "<script language=\"javascript\">" +
                    "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                    "</script>";
                return null;
            }


            news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            vars.Add("NewsTitle", news.Title);
            vars.Add("NewsText", news.Text);
            vars.Add("NewsID", news.ID.ToString());

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            return vars;
        }
Example #6
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();

            if (requestParameters.ContainsKey("Submit"))
            {
                string             title     = requestParameters["NewsTitle"].ToString();
                string             text      = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>();
                GridNewsItem       item      = new GridNewsItem {
                    Text = text, Time = DateTime.Now, Title = title
                };
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                response = "<h3>News item added successfully, redirecting to main page</h3>" +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                           "</script>";
                return(null);
            }

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return(vars);
        }
Example #7
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary <string, object>();

            if (requestParameters.ContainsKey("Submit"))
            {
                string             title     = requestParameters["NewsTitle"].ToString();
                string             text      = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>();
                GridNewsItem       item      = new GridNewsItem {
                    Text = text, Time = DateTime.Now, Title = title
                };
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                vars["ErrorMessage"] = "News item added successfully";
                webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
                return(vars);
            }
            else
            {
                vars["ErrorMessage"] = "";
            }

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return(vars);
        }
Example #8
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters,
                                                ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary <string, object>();
            IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin <IGenericsConnector>();
            GridNewsItem       news;

            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text  = requestParameters["NewsText"].ToString();
                string id    = requestParameters["NewsID"].ToString();
                news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id);
                connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
                GridNewsItem item = new GridNewsItem {
                    Text = text, Time = news.Time, Title = title, ID = int.Parse(id)
                };
                connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
                response = "<h3>News item editted successfully, redirecting to main page</h3>" +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                           "</script>";
                return(null);
            }


            news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            vars.Add("NewsTitle", news.Title);
            vars.Add("NewsText", news.Text);
            vars.Add("NewsID", news.ID.ToString());

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            return(vars);
        }
Example #9
0
        public Dictionary <string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                                OSHttpResponse httpResponse, Dictionary <string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary <string, object>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin <IGenericsConnector>();
            GridNewsItem       news;

            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text  = requestParameters["NewsText"].ToString();
                string id    = requestParameters["NewsID"].ToString();
                news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", id);
                connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
                GridNewsItem item = new GridNewsItem {
                    Text = text, Time = news.Time, Title = title, ID = int.Parse(id)
                };
                connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
                vars["ErrorMessage"] = "News item edit successfully";
                webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
                return(vars);
            }
            else
            {
                vars["ErrorMessage"] = "";
            }


            news = connector.GetGeneric <GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            vars.Add("NewsTitle", news.Title);
            vars.Add("NewsText", news.Text);
            vars.Add("NewsID", news.ID.ToString());

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            return(vars);
        }
Example #10
0
 private void AddNewsItem()
 {
     IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
     GridNewsItem item = new GridNewsItem();
     item.Time = DateTime.Now;
     item.Title = MainConsole.Instance.Prompt("News Item Title: ");
     MainConsole.Instance.Info("News Item Text (will continue reading until a blank line is inputted): ");
     string curText;
     while ((curText = Console.ReadLine()) != "")
         item.Text += "\n" + curText;
     item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews");
     connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
     MainConsole.Instance.Info("News item was added");
 }