Exemplo n.º 1
0
        public void NewMessage(string msgMarkup)
        {
            ChatUser chatClient = DBSupport.GetUser(new ChatUser {
                ConnectionId = Context.ConnectionId
            });

            string[] exceptUsers = null;
            if (chatClient == null)
            {
                string username = Context.RequestCookies["FunkyUser"].Value.Substring(0, Context.RequestCookies["FunkyUser"].Value.IndexOf('&'));
                username   = username.Substring(username.IndexOf('=') + 1);
                chatClient = DBSupport.GetUser(new ChatUser {
                    Username = username
                });
                exceptUsers = SharedSupport.ExceptUsers(chatClient);
                exceptUsers = exceptUsers.Concat(new string[] { Context.ConnectionId }).ToArray();
                exceptUsers = exceptUsers.ToList().Where(x => !x.Equals(chatClient.ConnectionId)).ToArray();
            }
            else
            {
                exceptUsers = SharedSupport.ExceptUsers(chatClient);
            }

            //For updating context user connect time
            DBSupport.UpdateUser(chatClient);

            Clients.AllExcept(exceptUsers).newUserMessage(msgMarkup);
        }
Exemplo n.º 2
0
        private void populateControls(CourseM course)
        {
            //Update - Load existing Course and populate fields
            txtDescription.Text    = course.Description;
            txtHomePageURL.Text    = course.HomepageURL;
            txtShortNameValue.Text = course.Name;

            // Use the CourseID to create a unique xml filename for the course.
            string filename = course.CourseID + ".xml";

            if (SharedSupport.UsingSsl == true)
            {
                txtStudentURL.Text = @"https://" +
                                     SharedSupport.BaseUrl +
                                     AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY +
                                     Server.UrlEncode(filename);
            }
            else
            {
                txtStudentURL.Text = @"http://" +
                                     SharedSupport.BaseUrl +
                                     AssignmentManager.Constants.ASSIGNMENTMANAGER_COURSES_DIRECTORY +
                                     Server.UrlEncode(filename);
            }

            btnUpdate.Text = SharedSupport.GetLocalizedString("AddEditCourse_UpdateText");
        }
Exemplo n.º 3
0
        public ActionResult Chat()
        {
            // Meta Tags
            ViewBag.Title           = "Chatfunky: Live Chat";
            ViewBag.MetaDescription = "Chatfunky allows you to live chat, communicate with people and make friends online.";
            ViewBag.MetaKeywords    = "online, chat, online chat, live, live chat, chat room, public chat, common, common chat, chatfunky";
            // Meta Tags

            ChatUser user = TempData["user"] as ChatUser;

            if (user != null)
            {
                if (DBSupport.GetUser(user) != null)
                {
                    if (SharedSupport.GetCookieUser() == null || (SharedSupport.GetCookieUser() != null &&
                                                                  SharedSupport.GetCookieUser().Id != DBSupport.GetUser(user).Id))
                    {
                        TempData["error"] = usernameExists.Replace("username", user.Username);
                        return(RedirectToAction("Home", new { logout = "true" }));
                    }
                }
                ViewBag.TotalUsers = DBSupport.GetUsersCount();
                if (SharedSupport.GetCookieUser() != null && DBSupport.GetUser(user) != null)
                {
                    ViewBag.DuplicateTab = SharedSupport.GetCookieUser().Id == DBSupport.GetUser(user).Id ? true : false;
                }
                SharedSupport.SetCookieUser(user);
                return(View(user));
            }

            TempData["error"] = Request.UrlReferrer != null ? (HttpContext.Session["usernameError"] != null ?
                                                               HttpContext.Session["usernameError"].ToString() : sessionExpired) : sessionExpired;
            HttpContext.Session.Remove("usernameError");
            return(RedirectToAction("Home"));
        }
Exemplo n.º 4
0
        public string UploadAudio()
        {
            string mp3      = null;
            string filePath = null;

            if (!string.IsNullOrEmpty(Request.Files[0].FileName))
            {
                HttpPostedFileBase file    = Request.Files[0];
                BinaryReader       b       = new BinaryReader(file.InputStream);
                byte[]             binData = b.ReadBytes(Convert.ToInt32(file.InputStream.Length));
                mp3 = System.Text.Encoding.UTF8.GetString(binData);
                byte[] binaryData   = Convert.FromBase64String(mp3.Replace("data:audio/mp3;base64,", ""));
                Stream sampleStream = new MemoryStream(binaryData);
                string audioName    = "Audio_" + DateTime.Now.Ticks + ".mp3";
                filePath = SharedSupport.SharedAudiosPath + audioName;
                string webpath = SharedSupport.GetAudioFolderPath() + audioName;
                using (FileStream writerStream = System.IO.File.Open(webpath, FileMode.CreateNew))
                {
                    Byte[] data = new Byte[binaryData.Count()];
                    for (byte i = 0; i < 100; i++)
                    {
                        Int32 readeDataLength = sampleStream.Read(data, 0, data.Count());
                        writerStream.Write(data, 0, readeDataLength);
                    }
                }
            }
            return(filePath);
        }
Exemplo n.º 5
0
        //private readonly string oneInstance = "Only one session can be made via one browser window for specific user!";

        //[OutputCache(Duration = 0, Location = System.Web.UI.OutputCacheLocation.Server, NoStore = true)]
        public ActionResult Home(string logout)
        {
            // Meta Tags
            ViewBag.Title           = "Chatfunky: Live Chat | Free Text & Media Messages";
            ViewBag.MetaDescription = "Join the funky network of Chatfunky. Live chat online, send instant text messages, share photos, connect & collaborate with people across the globe.";
            ViewBag.MetaKeywords    = "online, chat, online chat, live, live chat, chat room, chatfunky";
            // Meta Tags

            ViewBag.TotalUsers = DBSupport.GetUsersCount();
            ViewBag.Error      = TempData["error"];

            // If User press logout button then its clears the user info cookie

            if (logout == "true")
            {
                Response.Cookies["FunkyUser"].Values["Expiry"] = DateTime.UtcNow.AddDays(-1).ToString("dd MMM yyyy");
                return(View(new User()));
            }

            // Checking if User info cookie exists at first then fetch User information from it and then make him/her automatic login to chatroom
            if (SharedSupport.GetCookieUser() != null && Convert.ToDateTime(Request.Cookies["FunkyUser"].Values["Expiry"]) > DateTime.UtcNow)
            {
                TempData["user"] = SharedSupport.GetCookieUser();
                return(RedirectToAction("Chat"));
            }
            else
            {
                return(View(new User()));
            }
        }
Exemplo n.º 6
0
        public void btnUpdate_Click(object sender, System.EventArgs e)
        {
            try
            {
                //Check Security Permissions
                if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.COURSE_EDIT))
                {
                    throw new Exception(SharedSupport.GetLocalizedString("Global_Unauthorized"));
                }

                CourseM course = CourseM.Load(courseId);
                if (course.IsValid)
                {
                    //Update - Load existing Course and populate fields
                    course.Name              = txtShortNameValue.Text.ToString();
                    course.Description       = txtDescription.Text.ToString();
                    course.HomepageURL       = txtHomePageURL.Text.ToString();
                    course.LastUpdatedDate   = DateTime.Now;
                    course.LastUpdatedUserID = SharedSupport.GetUserIdentity();

                    course.Update();
                    populateControls(course);
                    Response.Redirect(@"./AddEditCourse.aspx?CourseID=" + courseId + "&Action=Update");
                }
                else
                {
                    // throw error - can't use this page without CourseID int passed in
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "AddEditCourse_MissingCourseID&" + Request.QueryString.ToString(), false);
                }
            }
            catch (Exception ex)
            {
                Nav1.Feedback.Text = ex.Message.ToString();
            }
        }
        private void localizeLabels()
        {
            //Labels
            lblEmailAddress.Text = SharedSupport.GetLocalizedString("AdminImport_Email");
            lblFirstName.Text    = SharedSupport.GetLocalizedString("AdminImport_FirstName");
            //lblImportedFileLocation.Text = SharedSupport.GetLocalizedString("AdminImport_ImportedFileLocation");
            lblLastName.Text     = SharedSupport.GetLocalizedString("AdminImport_LastName");
            lblMiddleName.Text   = SharedSupport.GetLocalizedString("AdminImport_MiddleName");
            lblUniversityID.Text = SharedSupport.GetLocalizedString("AdminImport_UniversityID");
            lblUserName.Text     = SharedSupport.GetLocalizedString("AdminImport_UserName");
            lblTitle.Text        = SharedSupport.GetLocalizedString("AdminImport_Title");
            lblDescription.Text  = SharedSupport.GetLocalizedString("AdminImport_ImportFormPreview_SubTitle");
            //Buttons
            btnImportRecords.Text = SharedSupport.GetLocalizedString("AdminImport_ImportRecords");
            btnCancel.Text        = SharedSupport.GetLocalizedString("AdminImport_Cancel");

            //Set readonly properties
            txtImportedFileLocation.ReadOnly = true;

            //add items to combo boxes
            if (!Page.IsPostBack)
            {
                //Set the default value for each of the dropdown menus.
                int      dropdownIndex = 0;
                ListItem newListItem   = new ListItem(SharedSupport.GetLocalizedString("AdminImport_None"), dropdownIndex.ToString());

                cboEmailAddress.Items.Add(newListItem);
                cboFirstName.Items.Add(newListItem);
                cboLastName.Items.Add(newListItem);
                cboMiddleName.Items.Add(newListItem);
                cboUniversityID.Items.Add(newListItem);
                cboUserName.Items.Add(newListItem);
            }
        }
Exemplo n.º 8
0
        public void btnAutoCompile_Click(object sender, System.EventArgs e)
        {
            try
            {
                //make sure the user is allowed to do this
                if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USERASSIGNMENT_EDIT))
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized");
                }

                int[] userAssignmentIds = getCheckedUserAssignmentIdsFromDataList();

                if (userAssignmentIds.Length < 1)
                {
                    Nav1.Feedback.Text = SharedSupport.GetLocalizedString("Submissions_NoSelectionMade");
                    return;
                }

                //call Auto Compile for each UserAssignmentID
                for (int i = 0; i < userAssignmentIds.Length; i++)
                {
                    StudentAssignmentM.SendActionToQueue(userAssignmentIds[i], true, false);
                }

                // refresh user assignments data list
                userAssignmentsRefresh();

                Nav1.Feedback.Text = SharedSupport.GetLocalizedString("FacultySubmissions_BuildSubmitSuccessful");
            }
            catch (Exception ex)
            {
                Nav1.Feedback.Text = ex.Message;
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // Initialize labels
                initializeLabels();
                // set the baseUrl variable
                baseUrl = AssignmentManager.SharedSupport.BaseUrl.ToString();

                // set logoff link dynamically based on if server is using SSL
                if (Convert.ToBoolean(SharedSupport.UsingSsl) == true)
                {
                    rootURL = "https://" + baseUrl + @"/";
                }
                else
                {
                    rootURL = "http://" + baseUrl + @"/";
                }

                // logs user off if actionLogoff hidden input tag = "logoff" (e.g. click on Logoff link)
                if (Page.Request["actionLogoff"] == "logoff")
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect(rootURL + "logoff.aspx");
                }
                // Put user code to initialize the page here
                userId = SharedSupport.GetUserIdentity();
                AssignmentManager.Common.Functions fun = new AssignmentManager.Common.Functions();
                CourseId = fun.ValidateNumericQueryStringParameter(Request, "CourseID");
            }
            catch (Exception ex)
            {
                Feedback.Text = ex.Message;
            }
        }
Exemplo n.º 10
0
 private void LocalizeLabels()
 {
     Nav1.Feedback.Text         = String.Empty;
     lblDelimitedCharacter.Text = SharedSupport.GetLocalizedString("AdminImport_Delimited_Char");
     lblSelectFile.Text         = SharedSupport.GetLocalizedString("AdminImport_SelectFile");
     btnPreview.Text            = SharedSupport.GetLocalizedString("AdminImport_Preview");  //"Preview";
     btnCancel.Text             = SharedSupport.GetLocalizedString("AdminImport_Cancel");
 }
 protected void LocalizeLabels()
 {
     lblAddResource.Text  = SharedSupport.GetLocalizedString("AddResource_AddResourcesText");
     lblResourceName.Text = SharedSupport.GetLocalizedString("AddResource_DisplayName");
     lblNameExample.Text  = SharedSupport.GetLocalizedString("AddResource_DisplayNameExample");
     lblResourceLink.Text = SharedSupport.GetLocalizedString("AddResource_LinkInfo");
     lblLinkExample.Text  = SharedSupport.GetLocalizedString("AddResource_LinkInfoExample");
 }
 protected void LocalizeLabels()
 {
     this.lblConfirmPwd.Text = SharedSupport.GetLocalizedString("ChangePassword_ConfirmPwdHeader");
     this.lblNewPwd.Text     = SharedSupport.GetLocalizedString("ChangePassword_NewPwdHeader1");
     this.btnCancel.Text     = SharedSupport.GetLocalizedString("ChangePassword_btnCancel");
     this.btnSave.Text       = SharedSupport.GetLocalizedString("ChangePassword_btnSave");
     this.lblUser.Text       = SharedSupport.GetLocalizedString("ChangePassword_lblUser");
     this.lblRequired.Text   = SharedSupport.GetLocalizedString("Global_RequiredFieldIndicator");
 }
Exemplo n.º 13
0
 public void Setup()
 {
     _processManager           = A.Fake <IProcessManager>();
     _pathConfiguration        = new PathConfiguration();
     CommonBase.AssemblyLoader = SharedSupport.GetAssemblyLoader();
     _pathConfiguration.SetPaths();
     _tempRsyncExe = _pathConfiguration.ToolCygwinBinPath.GetChildFileWithName("rsync.exe");
     _launcher     = new RsyncLauncher(_processManager, _pathConfiguration, new RsyncOutputParser());
 }
Exemplo n.º 14
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                // grab CourseID parameter from the querystring
                AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions();
                courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID");

                UserM user = UserM.Load(SharedSupport.GetUserIdentity());
                if (!user.IsInCourse(courseId))
                {
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized");
                }

                Nav1.Feedback.Text = String.Empty;
                Nav1.SideTabId     = AssignmentManager.Common.constants.SIDE_NAV_STUDENT_CHANGE_PASSWORD;
                Nav1.TopTabId      = AssignmentManager.Common.constants.TOP_NAV_STUDENT_CHANGE_PASSWORD;
                Nav1.Title         = SharedSupport.GetLocalizedString("ChangePassword_Title1");
                Nav1.SubTitle      = SharedSupport.GetLocalizedString("ChangePassword_SubTitle1");
                Nav1.relativeURL   = @"../";

                //GoBack1.GoBack_HelpUrl = SharedSupport.HelpRedirect("vstskChangingYourUserPassword");
                GoBack1.GoBack_HelpUrl    = SharedSupport.HelpRedirect("tskChangingYourUserPasswordForAssignmentManager");
                GoBack1.GoBack_left       = "275px";
                GoBack1.GoBack_top        = "-15px";
                GoBack1.GoBackIncludeBack = false;

                if (courseId <= 0)
                {
                    throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter")));
                }

                // if using SSL and the page isn't using a secure connection, redirect to https
                if (SharedSupport.UsingSsl == true && Request.IsSecureConnection == false)
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect("https://" + SharedSupport.BaseUrl + "/faculty/ChangePassword.aspx?CourseID=" + courseId.ToString());
                }

                if (!IsPostBack)
                {
                    // Evals true first time browser hits the page
                    LocalizeLabels();
                }

                Response.Cache.SetNoStore();
                if (user.IsValid)
                {
                    this.lblUserName.Text = Server.HtmlEncode(user.FirstName + " " + user.LastName);
                }
            }
            catch (Exception ex)
            {
                Nav1.Feedback.Text = ex.Message.ToString();
            }
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Response.Cache.SetNoStore();

                Nav1.Feedback.Text = String.Empty;
                Nav1.SideTabId     = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT;
                Nav1.TopTabId      = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS;
                Nav1.relativeURL   = @"../";

                GoBack1.GoBack_HelpUrl    = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager");
                GoBack1.GoBackIncludeBack = true;
                GoBack1.GoBack_left       = "400px";
                GoBack1.GoBack_top        = "-5px";
                GoBack1.GoBack_BackURL    = "Assignments.aspx?" + Request.QueryString.ToString();

                AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions();
                // grab CourseID parameter from the querystring
                courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID");

                if (courseId <= 0)
                {
                    throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter")));
                }

                // grab assignmentID from querystring
                assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "AssignmentID");

                //Check Security Permissions
                if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USERASSIGNMENT_VIEW))
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized");
                }

                Nav1.Feedback.Text = String.Empty;

                if (!IsPostBack)
                {
                    //
                    // Evals true first time browser hits the page
                    //

                    //Get localization string for all text displayed on the page
                    LocalizeLabels();

                    // refresh user assignments datalist
                    userAssignmentsRefresh();
                }
            }
            catch (Exception ex)
            {
                Nav1.Feedback.Text = ex.Message;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                // Do not cache this page
                Response.Cache.SetNoStore();

                Nav1.Feedback.Text = String.Empty;
                Nav1.SideTabId     = AssignmentManager.Common.constants.SIDE_NAV_COURSE_MANAGEMENT;
                Nav1.TopTabId      = AssignmentManager.Common.constants.TOP_NAV_COURSE_ASSIGNMENTS;
                Nav1.relativeURL   = @"../";

                GoBack1.GoBack_HelpUrl    = SharedSupport.HelpRedirect("vsoriUsingAssignmentManager");
                GoBack1.GoBackIncludeBack = true;
                GoBack1.GoBack_BackURL    = "Submissions.aspx?" + "CourseID=" + Request.QueryString["CourseID"].ToString() + "&" + "AssignmentID=" + Request.QueryString["AssignmentID"].ToString();

                // grab CourseID parameter from the querystring
                AssignmentManager.Common.Functions func = new AssignmentManager.Common.Functions();
                courseId = func.ValidateNumericQueryStringParameter(this.Request, "CourseID");

                if (courseId.Equals(null))
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_MissingParameter");
                }

                // get UserAssignmentID, AssignmentID querystring param
                studentID    = func.ValidateNumericQueryStringParameter(this.Request, "UserID");
                assignmentId = func.ValidateNumericQueryStringParameter(this.Request, "AssignmentID");

                if (!SharedSupport.SecurityIsAllowed(courseId, SecurityAction.USERASSIGNMENT_VIEW))
                {
                    // Note that Redirect ends page execution.
                    Response.Redirect(@"../Error.aspx?ErrorDetail=" + "Global_Unauthorized");
                }

                if (studentID == 0)
                {
                    //If userassignmentId missing then doesn't make sense to show page at all?
                    throw(new ArgumentException(SharedSupport.GetLocalizedString("Global_MissingParameter")));
                }

                LocalizeLabels();

                if (!Page.IsPostBack)
                {
                    // load the details
                    userAssignmentDetailRefresh();
                }
            }
            catch (System.Exception ex)
            {
                Nav1.Feedback.Text = ex.Message.ToString();
            }
        }
Exemplo n.º 17
0
 private void LocalizeLabels()
 {
     txtDescription.Text      = String.Empty;
     lblDescription.Text      = SharedSupport.GetLocalizedString("AddEditCourse_lblDescription");                                                                //"Description: ";
     txtHomePageURL.Text      = String.Empty;
     lblHomePageURL.Text      = SharedSupport.GetLocalizedString("AddEditCourse_lblHomePageURL1");                                                               //"Home Page URL: ";
     lblShortName.Text        = SharedSupport.GetLocalizedString("AddEditCourse_lblShortName") + " " + SharedSupport.GetLocalizedString("Global_RequiredField"); //"Course Name: ";
     btnUpdate.Text           = SharedSupport.GetLocalizedString("AddEditCourse_btnUpdate");                                                                     //"Insert";
     this.lblStudentURL.Text  = SharedSupport.GetLocalizedString("AddEditCourse_lblStudentURL");
     this.lblAddResource.Text = SharedSupport.GetLocalizedString("AddEditCourse_lblAddResource1");
     this.lblRequired.Text    = SharedSupport.GetLocalizedString("Global_RequiredFieldIndicator");
 }
        private void setNewPassword(int userID)
        {
            UserM user = UserM.Load(userID);

            if (user.IsValid)
            {
                // If user is changing their own password, then set HasChanged flag.
                bool hasChanged = (user.UserID == SharedSupport.GetUserIdentity());
                user.SetPassword(txtNewPwd.Text.Trim(), hasChanged);
                Nav1.Feedback.Text = SharedSupport.GetLocalizedString("MyAccountChangePassword_Successful");
            }
        }